From 3123c8fda5f5ffa2e989eec780db438dc34bb0d0 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 2 Jul 2012 09:12:13 -0700 Subject: [PATCH] Use UTC consistently instead of local timezone. Signed-off-by: Arun Sharma Signed-off-by: Ben Pfaff --- NEWS | 2 ++ lib/table.c | 2 +- lib/vlog.c | 4 ++-- ovsdb/ovsdb-tool.c | 2 +- utilities/ovs-ofctl.c | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index f0b24907..550cf597 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,8 @@ post-v1.7.0 - Open vSwitch now sends RARP packets in situations where it previously sent a custom protocol, making it consistent with behavior of QEMU and VMware. + - "ovsdb-tool show-log" and the --timestamp options on ovsdb-client and + ovs-ofctl now display timestamps in UTC instead of the local timezone. v1.7.0 - xx xxx xxxx diff --git a/lib/table.c b/lib/table.c index a8b35e21..f24ddc62 100644 --- a/lib/table.c +++ b/lib/table.c @@ -224,7 +224,7 @@ static void table_format_timestamp__(char *s, size_t size) { time_t now = time_wall(); - strftime(s, size, "%Y-%m-%d %H:%M:%S", localtime(&now)); + strftime(s, size, "%Y-%m-%d %H:%M:%S", gmtime(&now)); } static void diff --git a/lib/vlog.c b/lib/vlog.c index e5c5feb7..d26e6139 100644 --- a/lib/vlog.c +++ b/lib/vlog.c @@ -498,8 +498,8 @@ vlog_init(void) struct tm tm; char s[128]; - localtime_r(&now, &tm); - strftime(s, sizeof s, "%a, %d %b %Y %H:%M:%S %z", &tm); + gmtime_r(&now, &tm); + strftime(s, sizeof s, "%a, %d %b %Y %H:%M:%S", &tm); VLOG_ERR("current time is negative: %s (%ld)", s, (long int) now); } diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c index f6809896..f5412f36 100644 --- a/ovsdb/ovsdb-tool.c +++ b/ovsdb/ovsdb-tool.c @@ -513,7 +513,7 @@ do_show_log(int argc, char *argv[]) time_t t = json_integer(date); char s[128]; - strftime(s, sizeof s, "%Y-%m-%d %H:%M:%S", localtime(&t)); + strftime(s, sizeof s, "%Y-%m-%d %H:%M:%S", gmtime(&t)); printf(" %s", s); } diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index a2dfabf6..dbc46cd4 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -1127,7 +1127,7 @@ monitor_vconn(struct vconn *vconn) time_t now = time_wall(); char s[32]; - strftime(s, sizeof s, "%Y-%m-%d %H:%M:%S: ", localtime(&now)); + strftime(s, sizeof s, "%Y-%m-%d %H:%M:%S: ", gmtime(&now)); fputs(s, stderr); } -- 2.30.2