summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-07-11 01:03:14 +0200
committerKay Sievers <kay.sievers@vrfy.org>2011-07-11 01:03:14 +0200
commit2315e570706285216a130eb1a67402284344b85f (patch)
treec6526d5222eb8751a3d02b8a9b1e1f3f1a82aab8 /udev
parentce60b80f87a0365565722d2a523b7defc3abdec3 (diff)
udevadm: monitor - use uptime to match the kernel's timestamp
Diffstat (limited to 'udev')
-rw-r--r--udev/udevadm-monitor.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
index 0852fe301b..9b8bf4eccf 100644
--- a/udev/udevadm-monitor.c
+++ b/udev/udevadm-monitor.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <signal.h>
#include <getopt.h>
+#include <time.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/un.h>
@@ -43,13 +44,12 @@ static void sig_handler(int signum)
static void print_device(struct udev_device *device, const char *source, int prop)
{
- struct timeval tv;
- struct timezone tz;
+ struct timespec ts;
- gettimeofday(&tv, &tz);
+ clock_gettime(CLOCK_MONOTONIC, &ts);
printf("%-6s[%llu.%06u] %-8s %s (%s)\n",
source,
- (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec,
+ (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000,
udev_device_get_action(device),
udev_device_get_devpath(device),
udev_device_get_subsystem(device));