summaryrefslogtreecommitdiff
path: root/src/timesync
diff options
context:
space:
mode:
Diffstat (limited to 'src/timesync')
-rw-r--r--src/timesync/timesyncd-manager.c15
-rw-r--r--src/timesync/timesyncd-manager.h1
2 files changed, 14 insertions, 2 deletions
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
index a9e91c4d60..88e9cf98ed 100644
--- a/src/timesync/timesyncd-manager.c
+++ b/src/timesync/timesyncd-manager.c
@@ -669,6 +669,16 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
m->poll_interval_usec / USEC_PER_SEC, offset, delay, m->samples_jitter, m->drift_ppm,
spike ? " (ignored)" : "");
+ if (!m->good) {
+ _cleanup_free_ char *pretty = NULL;
+
+ m->good = true;
+
+ server_address_pretty(m->current_server_address, &pretty);
+ log_info("Synchronized to time server %s (%s).", strna(pretty), m->current_server_name->string);
+ sd_notifyf(false, "STATUS=Synchronized to time server %s (%s).", strna(pretty), m->current_server_name->string);
+ }
+
r = manager_arm_timer(m, m->poll_interval_usec);
if (r < 0)
return log_error_errno(r, "Failed to rearm timer: %m");
@@ -724,13 +734,14 @@ static int manager_begin(Manager *m) {
assert_return(m->current_server_name, -EHOSTUNREACH);
assert_return(m->current_server_address, -EHOSTUNREACH);
+ m->good = false;
m->missed_replies = NTP_MAX_MISSED_REPLIES;
if (m->poll_interval_usec == 0)
m->poll_interval_usec = NTP_POLL_INTERVAL_MIN_SEC * USEC_PER_SEC;
server_address_pretty(m->current_server_address, &pretty);
- log_debug("Using NTP server %s (%s).", strna(pretty), m->current_server_name->string);
- sd_notifyf(false, "STATUS=Using Time Server %s (%s).", strna(pretty), m->current_server_name->string);
+ log_debug("Connecting to time server %s (%s).", strna(pretty), m->current_server_name->string);
+ sd_notifyf(false, "STATUS=Connecting to time server %s (%s).", strna(pretty), m->current_server_name->string);
r = manager_clock_watch_setup(m);
if (r < 0)
diff --git a/src/timesync/timesyncd-manager.h b/src/timesync/timesyncd-manager.h
index b1a844ba76..090b2fcba8 100644
--- a/src/timesync/timesyncd-manager.h
+++ b/src/timesync/timesyncd-manager.h
@@ -55,6 +55,7 @@ struct Manager {
int missed_replies;
uint64_t packet_count;
sd_event_source *event_timeout;
+ bool good;
/* last sent packet */
struct timespec trans_time_mon;