From 99412d6d5ae0697d223bddf283c453bb29151037 Mon Sep 17 00:00:00 2001 From: Ulrich Windl Date: Thu, 24 Aug 2017 09:22:57 +0200 Subject: Print NTP timestamps as UTC, not local time print-ntp.c: Change p_ntp_time() to print NTP timestamps in UTC instead of local time. This allows for consistent output for automatic testing different time zones. Also use an ISO 8601 (RFC3339) format for the time stamps. --- print-ntp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'print-ntp.c') diff --git a/print-ntp.c b/print-ntp.c index 8edb58fc..a0b04641 100644 --- a/print-ntp.c +++ b/print-ntp.c @@ -366,15 +366,16 @@ p_ntp_time(netdissect_options *ndo, #ifdef HAVE_STRFTIME /* - * print the time in human-readable format. + * print the UTC time in human-readable format. */ if (i) { time_t seconds = i - JAN_1970; struct tm *tm; char time_buf[128]; - tm = localtime(&seconds); - strftime(time_buf, sizeof (time_buf), "%Y/%m/%d %H:%M:%S", tm); + tm = gmtime(&seconds); + /* use ISO 8601 (RFC3339) format */ + strftime(time_buf, sizeof (time_buf), "%Y-%m-%dT%H:%M:%S", tm); ND_PRINT((ndo, " (%s)", time_buf)); } #endif -- cgit v1.2.1