From 3a33c8e294bf1b4338fc81bcd9b0889de3c0e0f0 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Sun, 31 Dec 2006 12:20:54 +0000 Subject: * tools/dbus-monitor.c: gettimeofday() is not available on windows so we have to provide our own. It's taken from lgpl'd kdewin32 package. - Patches from Christian Ehrlicher --- tools/dbus-monitor.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tools') diff --git a/tools/dbus-monitor.c b/tools/dbus-monitor.c index eb3da072..9f7da5b2 100644 --- a/tools/dbus-monitor.c +++ b/tools/dbus-monitor.c @@ -24,13 +24,42 @@ #include #include +#ifdef DBUS_WIN +#include +#undef interface +#else #include +#endif + #include #include #include "dbus-print-message.h" +#ifdef DBUS_WIN + +/* gettimeofday is not defined on windows */ +#define DBUS_SECONDS_SINCE_1601 11644473600LL +#define DBUS_USEC_IN_SEC 1000000LL + +static int +gettimeofday (struct timeval *__p, + void *__t) +{ + union { + unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */ + FILETIME ft; + } now; + + GetSystemTimeAsFileTime (&now.ft); + __p->tv_usec = (long) ((now.ns100 / 10LL) % DBUS_USEC_IN_SEC); + __p->tv_sec = (long)(((now.ns100 / 10LL) / DBUS_SECONDS_SINCE_1601) - DBUS_SECONDS_SINCE_1601); + + return 0; +} +#endif + static DBusHandlerResult monitor_filter_func (DBusConnection *connection, DBusMessage *message, -- cgit