[ovs-dev] [PATCH] Using UTC in all of ovs logs

Arun Sharma arun.sharma at calsoftinc.com
Fri Jun 29 02:23:48 UTC 2012


Fixed the remaining programs which does not logs in UTC timestamp format.

Signed-off-by: Arun Sharma <arun.sharma at calsoftinc.com>
---
 lib/table.c           |    2 +-
 lib/vlog.c            |    2 +-
 ovsdb/ovsdb-tool.c    |    2 +-
 utilities/ovs-ofctl.c |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/table.c b/lib/table.c
index a8b35e2..f24ddc6 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 e5c5feb..f7f0c73 100644
--- a/lib/vlog.c
+++ b/lib/vlog.c
@@ -498,7 +498,7 @@ vlog_init(void)
         struct tm tm;
         char s[128];
 
-        localtime_r(&now, &tm);
+        gmtime_r(&now, &tm);
         strftime(s, sizeof s, "%a, %d %b %Y %H:%M:%S %z", &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 f680989..f5412f3 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 a2dfabf..dbc46cd 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);
             }
 
-- 
1.7.2.5




More information about the dev mailing list