summaryrefslogtreecommitdiff
path: root/src/timedate/test-timedate-sntp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/timedate/test-timedate-sntp.c')
-rw-r--r--src/timedate/test-timedate-sntp.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/timedate/test-timedate-sntp.c b/src/timedate/test-timedate-sntp.c
index 41999c85cb..a0ed4ac271 100644
--- a/src/timedate/test-timedate-sntp.c
+++ b/src/timedate/test-timedate-sntp.c
@@ -74,14 +74,16 @@ static void manager_free(Manager *m) {
free(m);
}
+static void manager_report(usec_t poll_usec, double offset, double delay, double jitter, bool spike) {
+ log_info("%4llu %+10f %10f %10f%s",
+ poll_usec / USEC_PER_SEC, offset, delay, jitter, spike ? " spike" : "");
+}
+
int main(int argc, char *argv[]) {
_cleanup_manager_free_ Manager *m = NULL;
const char *server;
int r;
- if (argv[1])
- log_set_max_level(LOG_DEBUG);
-
r = manager_new(&m);
if (r < 0)
goto out;
@@ -90,6 +92,11 @@ int main(int argc, char *argv[]) {
if (r < 0)
goto out;
+ if (argv[1])
+ log_set_max_level(LOG_DEBUG);
+ else
+ sntp_report_register(m->sntp, manager_report);
+
//server = "216.239.32.15"; /* time1.google.com */
//server = "192.53.103.108"; /* ntp1.ptb.de */
server = "130.102.2.123"; /* 0.au.pool.ntp.org */