aboutsummaryrefslogtreecommitdiff
path: root/qapi
diff options
context:
space:
mode:
Diffstat (limited to 'qapi')
-rw-r--r--qapi/qmp-event.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/qapi/qmp-event.c b/qapi/qmp-event.c
index 19d3cd0..0fe0d0a 100644
--- a/qapi/qmp-event.c
+++ b/qapi/qmp-event.c
@@ -20,15 +20,12 @@
static void timestamp_put(QDict *qdict)
{
- int err;
QDict *ts;
- qemu_timeval tv;
+ int64_t rt = g_get_real_time();
- err = qemu_gettimeofday(&tv);
- /* Put -1 to indicate failure of getting host time */
ts = qdict_from_jsonf_nofail("{ 'seconds': %lld, 'microseconds': %lld }",
- err < 0 ? -1LL : (long long)tv.tv_sec,
- err < 0 ? -1LL : (long long)tv.tv_usec);
+ (long long)rt / G_USEC_PER_SEC,
+ (long long)rt % G_USEC_PER_SEC);
qdict_put(qdict, "timestamp", ts);
}