|
@@ -0,0 +1,53 @@
+From 82f8aad0c0e655a37359146923bcd9ef34a35fb5 Mon Sep 17 00:00:00 2001
+From: Kimmo Lindholm <kimmo@eke.fi>
+Date: Sun, 11 Dec 2016 13:39:44 +0200
+Subject: [PATCH] testing
+
+---
+ src/core/manager.c | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/src/core/manager.c b/src/core/manager.c
+index 58dacdc..4c74880 100644
+--- a/src/core/manager.c
++++ b/src/core/manager.c
+@@ -37,6 +37,7 @@
+ #include <sys/stat.h>
+ #include <dirent.h>
+ #include <sys/timerfd.h>
++#include <sys/sysinfo.h>
+
+ #ifdef HAVE_AUDIT
+ #include <libaudit.h>
+@@ -1730,9 +1731,27 @@ static int process_event(Manager *m, struct epoll_event *ev) {
+ Unit *u;
+ Iterator i;
+
++ struct sysinfo info;
++ sysinfo(&info);
++
++ /* calculate boot time in seconds since the Epoch */
++ const time_t boottime = time(NULL) - info.uptime;
++
++ /* get monotonic clock time */
++ struct timespec monotime;
++ clock_gettime(CLOCK_MONOTONIC, &monotime);
++
++ /* calculate current time in seconds since the Epoch */
++ time_t curtime = boottime + monotime.tv_sec;
++
++ /* get realtime clock time for comparison */
++ struct timespec realtime;
++ clock_gettime(CLOCK_REALTIME, &realtime);
++
+ log_struct(LOG_INFO,
+ MESSAGE_ID(SD_MESSAGE_TIME_CHANGE),
+- "MESSAGE=Time has been changed",
++ "MESSAGE=Time has been changed boot %s current %s real %s",
++ ctime(&boottime), ctime(&curtime), ctime(&realtime.tv_sec),
+ NULL);
+
+ /* Restart the watch */
+--
+1.7.9.5
+
|