From: Scott Worley Date: Thu, 26 Dec 2013 07:55:28 +0000 (-0800) Subject: Print usec timestamps correctly X-Git-Tag: v1.0.0~12 X-Git-Url: http://git.scottworley.com/keystroke-timestamps/commitdiff_plain/6fb4fdb90b700a290c3ad129338fc1715b478e39?ds=sidebyside;hp=-c Print usec timestamps correctly Don't drop zeros following the decimal point. --- 6fb4fdb90b700a290c3ad129338fc1715b478e39 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); }