From 2315e570706285216a130eb1a67402284344b85f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 11 Jul 2011 01:03:14 +0200 Subject: [PATCH] udevadm: monitor - use uptime to match the kernel's timestamp --- TODO | 2 -- udev/udevadm-monitor.c | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 13a27799f..01fb0e1fc 100644 --- a/TODO +++ b/TODO @@ -2,8 +2,6 @@ - test (now fixed) /dev/tape/ links - - monitor: use clock MONOTONIC - - remove RUN+="socket:" - libudev: return proper errno or set errno diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 0852fe301..9b8bf4ecc 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -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)); -- 2.30.2