[systemd-commits] src/timesync
Lennart Poettering
lennart at kemper.freedesktop.org
Wed Apr 8 11:14:46 PDT 2015
src/timesync/timesyncd-manager.c | 15 +++++++++++++--
src/timesync/timesyncd-manager.h | 1 +
2 files changed, 14 insertions(+), 2 deletions(-)
New commits:
commit 481b3f9e998d1981e01915bed34f55ea99af1542
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Apr 8 20:14:04 2015 +0200
timesyncd: print an INFO log message when we successfully reached a time server
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
index a9e91c4..88e9cf9 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 b1a844b..090b2fc 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;
More information about the systemd-commits
mailing list