]> git.scottworley.com Git - keystroke-timestamps/commitdiff
Print usec timestamps correctly
authorScott Worley <scottworley@scottworley.com>
Thu, 26 Dec 2013 07:55:28 +0000 (23:55 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 26 Dec 2013 07:55:28 +0000 (23:55 -0800)
Don't drop zeros following the decimal point.

keystroke-timestamps.c

index fd7de5d785bbd52f2482cf1c1d718d9cbd3c40f6..693560025031b7a521cde6a196b145e90be07ce3 100644 (file)
@@ -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) {
   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);
       }
       } else {
         printf("%ld\n", i.time.tv_sec);
       }