systemd-udev-settle.service:
@OFFENDING_UNITS@
+
+-- 7c8a41f37b764941a0e1780b1be2f037
+Subject: Initial clock synchronization
+Defined-By: systemd
+Support: %SUPPORT_URL%
+
+For the first time during the current boot an NTP synchronization has been
+acquired and the local system clock adjustment has been initiated.
#define SD_MESSAGE_SYSTEMD_UDEV_SETTLE_DEPRECATED_STR \
SD_ID128_MAKE_STR(1c,04,54,c1,bd,22,41,e0,ac,6f,ef,b4,bc,63,14,33)
+#define SD_MESSAGE_TIME_SYNC SD_ID128_MAKE(7c,8a,41,f3,7b,76,49,41,a0,e1,78,0b,1b,e2,f0,37)
+#define SD_MESSAGE_TIME_SYNC_STR SD_ID128_MAKE_STR(7c,8a,41,f3,7b,76,49,41,a0,e1,78,0b,1b,e2,f0,37)
+
_SD_END_DECLARATIONS;
#endif
#include <sys/types.h>
#include "sd-daemon.h"
+#include "sd-messages.h"
#include "alloc-util.h"
#include "dns-domain.h"
(void) sd_notifyf(false, "STATUS=Initial synchronization to time server %s (%s).", strna(pretty), m->current_server_name->string);
}
+ if (!spike && !m->synchronized) {
+ m->synchronized = true;
+
+ log_struct(LOG_INFO,
+ LOG_MESSAGE("Initial clock synchronization to %s.", FORMAT_TIMESTAMP_STYLE(dts.realtime, TIMESTAMP_US)),
+ "MESSAGE_ID=" SD_MESSAGE_TIME_SYNC_STR,
+ "MONOTONIC_USEC=" USEC_FMT, dts.monotonic,
+ "REALTIME_USEC=" USEC_FMT, dts.realtime,
+ "BOOTIME_USEC=" USEC_FMT, dts.boottime);
+ }
+
r = manager_arm_timer(m, m->poll_interval_usec);
if (r < 0)
return log_error_errno(r, "Failed to rearm timer: %m");
(void) sd_event_set_watchdog(m->event, true);
+ /* Load previous synchronization state */
+ r = access("/run/systemd/timesync/synchronized", F_OK);
+ if (r < 0 && errno != ENOENT)
+ log_debug_errno(errno, "Failed to determine whether /run/systemd/timesync/synchronized exists, ignoring: %m");
+ m->synchronized = r >= 0;
+
r = sd_resolve_default(&m->resolve);
if (r < 0)
return r;
struct timespec origin_time, dest_time;
bool spike;
+ /* Indicates whether we ever managed to set the local clock from NTP */
+ bool synchronized;
+
/* save time event */
sd_event_source *event_save_time;
usec_t save_time_interval_usec;