[PATCH evemu 5/6] tools: use CLOCK_MONOTONIC for recordings

Peter Hutterer peter.hutterer at who-t.net
Wed Sep 25 16:40:21 PDT 2013


Stops time jumps, even though they're rather unlikely anyway.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 tools/evemu-record.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/evemu-record.c b/tools/evemu-record.c
index 8fe2a57..c881e57 100644
--- a/tools/evemu-record.c
+++ b/tools/evemu-record.c
@@ -47,6 +47,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <signal.h>
+#include <time.h>
 
 #include "find_event_devices.h"
 
@@ -144,6 +145,11 @@ int main(int argc, char *argv[])
 	}
 
 	if (mode == EVEMU_RECORD) {
+#ifdef EVIOCSCLOCKID
+		int clockid = CLOCK_MONOTONIC;
+		ioctl(fd, EVIOCSCLOCKID, &clockid);
+#endif
+
 		fprintf(output,  "################################\n");
 		fprintf(output,  "#      Waiting for events      #\n");
 		fprintf(output,  "################################\n");
-- 
1.8.3.1



More information about the Input-tools mailing list