From 700031ade7cbcdcecf1205f98f50ed0da57c7493 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 18 Nov 2014 14:35:21 +0100 Subject: misc: use monotonic time rater than gettimeofday Based on patch Alexander Samilovskih Signed-off-by: Karel Zak --- sys-utils/eject.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sys-utils/eject.c') diff --git a/sys-utils/eject.c b/sys-utils/eject.c index 860610f5a..5a181644d 100644 --- a/sys-utils/eject.c +++ b/sys-utils/eject.c @@ -52,6 +52,7 @@ #include "xalloc.h" #include "pathnames.h" #include "sysfs.h" +#include "timeutils.h" /* * sg_io_hdr_t driver_status -- see kernel include/scsi/scsi.h @@ -462,7 +463,7 @@ static void toggle_tray(int fd) * needed. In my experience the function needs less than 0.05 * seconds if the tray was already open, and at least 1.5 seconds * if it was closed. */ - gettimeofday(&time_start, NULL); + gettime_monotonic(&time_start); /* Send the CDROMEJECT command to the device. */ if (!eject_cdrom(fd)) @@ -470,7 +471,7 @@ static void toggle_tray(int fd) /* Get the second timestamp, to measure the time needed to open * the tray. */ - gettimeofday(&time_stop, NULL); + gettime_monotonic(&time_stop); time_elapsed = (time_stop.tv_sec * 1000000 + time_stop.tv_usec) - (time_start.tv_sec * 1000000 + time_start.tv_usec); -- cgit v1.2.3-55-g7522