From fdead868312af39c0bc22423fcf97adb522c03f3 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Tue, 17 Feb 2015 08:22:13 +0100 Subject: [PATCH 2/4] dbus-monitor: Add timestamp to --monitor mode. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88896 --- tools/dbus-print-message.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/dbus-print-message.c b/tools/dbus-print-message.c index e4b8c8a..186ab8d 100644 --- a/tools/dbus-print-message.c +++ b/tools/dbus-print-message.c @@ -542,10 +542,19 @@ print_message (DBusMessage *message, dbus_bool_t literal) if (!literal) { - printf ("%s sender=%s -> dest=%s", - type_to_name (message_type), - sender ? sender : "(null sender)", - destination ? destination : "(null destination)"); + struct timeval t; + + if (gettimeofday (&t, NULL) < 0) + printf ("%s sender=%s -> dest=%s", + type_to_name (message_type), + sender ? sender : "(null sender)", + destination ? destination : "(null destination)"); + else + printf ("%s time=%lu.%06lu sender=%s -> dest=%s", + type_to_name (message_type), + (unsigned long) t.tv_sec, (unsigned long) t.tv_usec, + sender ? sender : "(null sender)", + destination ? destination : "(null destination)"); switch (message_type) { -- 1.8.4.5