From 6fb4fdb90b700a290c3ad129338fc1715b478e39 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Wed, 25 Dec 2013 23:55:28 -0800 Subject: [PATCH] Print usec timestamps correctly Don't drop zeros following the decimal point. --- keystroke-timestamps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keystroke-timestamps.c b/keystroke-timestamps.c index fd7de5d..6935600 100644 --- a/keystroke-timestamps.c +++ b/keystroke-timestamps.c @@ -37,7 +37,7 @@ int main (int argc, char **argv) while (read(fd, &i, sizeof(i)) == sizeof(i)) { if (i.type == 1 && i.value == 1) { if (print_usec) { - printf("%ld.%ld\n", i.time.tv_sec, i.time.tv_usec); + printf("%ld.%06ld\n", i.time.tv_sec, i.time.tv_usec); } else { printf("%ld\n", i.time.tv_sec); } -- 2.51.2