summaryrefslogtreecommitdiff
path: root/tools/dbus-monitor.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-03-04 12:10:17 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2015-03-05 13:14:37 +0000
commit188884dd624af8d489ab731c1f37ddbcc6d14282 (patch)
treefc36618447a4cc4976cfa1a2140971831e7750bf /tools/dbus-monitor.c
parent49d67163da975973379fb735c5348a83598b28c7 (diff)
downloaddbus-188884dd624af8d489ab731c1f37ddbcc6d14282.tar.gz
dbus-monitor: use _dbus_get_real_time instead of gettimeofday
gettimeofday is implicitly declared (i.e. not in our #include'd header files) when cross-compiling for on Windows. Now that fd.o#83115 has been fixed, using _dbus functions is not a problem. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89428 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Diffstat (limited to 'tools/dbus-monitor.c')
-rw-r--r--tools/dbus-monitor.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/tools/dbus-monitor.c b/tools/dbus-monitor.c
index 0aea2e71..9cec0a7a 100644
--- a/tools/dbus-monitor.c
+++ b/tools/dbus-monitor.c
@@ -218,7 +218,7 @@ binary_filter_func (DBusConnection *connection,
{
case BINARY_MODE_PCAP:
{
- struct timeval t = { 0, 0 };
+ long tv_sec, tv_usec;
/* seconds, microseconds, bytes captured (possibly truncated),
* original length.
* http://wiki.wireshark.org/Development/LibpcapFileFormat
@@ -228,15 +228,9 @@ binary_filter_func (DBusConnection *connection,
/* If this gets padded then we'd need to write it out in pieces */
_DBUS_STATIC_ASSERT (sizeof (header) == 16);
- if (_DBUS_UNLIKELY (gettimeofday (&t, NULL) < 0))
- {
- /* I'm fairly sure this can't actually happen */
- perror ("dbus-monitor: gettimeofday");
- exit (1);
- }
-
- header[0] = t.tv_sec;
- header[1] = t.tv_usec;
+ _dbus_get_real_time (&tv_sec, &tv_usec);
+ header[0] = tv_sec;
+ header[1] = tv_usec;
if (!tool_write_all (STDOUT_FILENO, header, sizeof (header)))
{