diff options
author | Kay Sievers <kay@vrfy.org> | 2014-03-17 00:18:55 +0100 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2014-03-17 00:18:55 +0100 |
commit | 9ec65868668839136ee10bcf6785938c3ad9a1a1 (patch) | |
tree | 8b47a133303277f981b23db98c9de707fa9dde30 /src/timedate/test-timedate-sntp.c | |
parent | a47b9e628367eb39ce00c3774e2b6488684fe6c0 (diff) |
timedated: move test logging to test program
Diffstat (limited to 'src/timedate/test-timedate-sntp.c')
-rw-r--r-- | src/timedate/test-timedate-sntp.c | 13 |
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 */ |