From: Alexander <alexsamilovskih@gmail.com>
To: alexander samilovskih <alexsamilovskih@gmail.com>,
util-linux@vger.kernel.org, kerolasa@iki.fi
Subject: [PATCH 2/3] sys-utils/eject: add monotonic clock support
Date: Mon, 05 May 2014 20:30:14 +0200 [thread overview]
Message-ID: <8403293.zXXAmOpAMP@alexpc.org> (raw)
>From b72b47b2f8e12c4cb53e817939bad464139e9042 Mon Sep 17 00:00:00 2001
From: Alex Samilovskih <alexsamilovskih@gmail.com>
Date: Fri, 2 May 2014 18:21:20 +0000
Subject: [PATCH 2/3] Add support for monotonic clock in eject
---
sys-utils/eject.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sys-utils/eject.c b/sys-utils/eject.c
index 03744c7..049cdb7 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
@@ -460,7 +461,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))
@@ -468,7 +469,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);
--
1.9.2
reply other threads:[~2014-05-05 13:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8403293.zXXAmOpAMP@alexpc.org \
--to=alexsamilovskih@gmail.com \
--cc=kerolasa@iki.fi \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox