summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--ovsdb/file.c2
-rw-r--r--ovsdb/ovsdb-tool.c12
3 files changed, 13 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 4dd956809..c46c3cc83 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,8 @@
Post-v2.0.0
---------------------
- - Log files now report times with millisecond resolution. (Previous
- versions only reported whole seconds.)
+ - Log file timestamps and ovsdb commit timestamps are now reported
+ with millisecond resolution. (Previous versions only reported
+ whole seconds.)
v2.0.0 - xx xxx xxxx
diff --git a/ovsdb/file.c b/ovsdb/file.c
index 4ccf33e72..7c8ac6f29 100644
--- a/ovsdb/file.c
+++ b/ovsdb/file.c
@@ -768,7 +768,7 @@ ovsdb_file_txn_commit(struct json *json, const char *comment,
if (comment) {
json_object_put_string(json, "_comment", comment);
}
- json_object_put(json, "_date", json_integer_create(time_wall()));
+ json_object_put(json, "_date", json_integer_create(time_wall_msec()));
error = ovsdb_log_write(log, json);
json_destroy(json);
diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c
index 867012743..077e7f5cb 100644
--- a/ovsdb/ovsdb-tool.c
+++ b/ovsdb/ovsdb-tool.c
@@ -518,9 +518,15 @@ do_show_log(int argc, char *argv[])
date = shash_find_data(json_object(json), "_date");
if (date && date->type == JSON_INTEGER) {
- time_t t = json_integer(date);
- char *s = xastrftime_msec(" %Y-%m-%d %H:%M:%S",
- t * 1000LL, true);
+ long long int t = json_integer(date);
+ char *s;
+
+ if (t < INT32_MAX) {
+ /* Older versions of ovsdb wrote timestamps in seconds. */
+ t *= 1000;
+ }
+
+ s = xastrftime_msec(" %Y-%m-%d %H:%M:%S.###", t, true);
fputs(s, stdout);
free(s);
}