/*
- * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
ds_clear(line);
}
-static void
-table_format_timestamp__(char *s, size_t size)
+static char *
+table_format_timestamp__(void)
{
- time_t now = time_wall();
- strftime(s, size, "%Y-%m-%d %H:%M:%S", gmtime(&now));
+ return xastrftime_msec("%Y-%m-%d %H:%M:%S.###", time_wall_msec(), true);
}
static void
table_print_timestamp__(const struct table *table)
{
if (table->timestamp) {
- char s[32];
-
- table_format_timestamp__(s, sizeof s);
+ char *s = table_format_timestamp__();
puts(s);
+ free(s);
}
}
json_object_put_string(json, "caption", table->caption);
}
if (table->timestamp) {
- char s[32];
-
- table_format_timestamp__(s, sizeof s);
+ char *s = table_format_timestamp__();
json_object_put_string(json, "time", s);
+ free(s);
}
headings = json_array_create_empty();