Getevent: make sure the monotonic timestamp is displayed; warning cleanup.

Change-Id: I6c500ab55470155ddf692fe5f655bdd575f195f5
Signed-off-by: Sasha Levitskiy <sanek@google.com>
diff --git a/toolbox/getevent.c b/toolbox/getevent.c
index c2256ff..da83ec3 100644
--- a/toolbox/getevent.c
+++ b/toolbox/getevent.c
@@ -295,6 +295,7 @@
 {
     int version;
     int fd;
+    int clkid = CLOCK_MONOTONIC;
     struct pollfd *new_ufds;
     char **new_device_names;
     char name[80];
@@ -335,6 +336,11 @@
         idstr[0] = '\0';
     }
 
+    if (ioctl(fd, EVIOCSCLOCKID, &clkid) != 0) {
+        fprintf(stderr, "Can't enable monotonic clock reporting: %s\n", strerror(errno));
+        // a non-fatal error
+    }
+
     new_ufds = realloc(ufds, sizeof(ufds[0]) * (nfds + 1));
     if(new_ufds == NULL) {
         fprintf(stderr, "out of memory\n");
@@ -470,9 +476,9 @@
     return 0;
 }
 
-static void usage(int argc, char *argv[])
+static void usage(char *name)
 {
-    fprintf(stderr, "Usage: %s [-t] [-n] [-s switchmask] [-S] [-v [mask]] [-d] [-p] [-i] [-l] [-q] [-c count] [-r] [device]\n", argv[0]);
+    fprintf(stderr, "Usage: %s [-t] [-n] [-s switchmask] [-S] [-v [mask]] [-d] [-p] [-i] [-l] [-q] [-c count] [-r] [device]\n", name);
     fprintf(stderr, "    -t: show time stamps\n");
     fprintf(stderr, "    -n: don't print newlines\n");
     fprintf(stderr, "    -s: print switch states for given bits\n");
@@ -568,7 +574,7 @@
             fprintf(stderr, "%s: invalid option -%c\n",
                 argv[0], optopt);
         case 'h':
-            usage(argc, argv);
+            usage(argv[0]);
             exit(1);
         }
     } while (1);
@@ -580,7 +586,7 @@
         optind++;
     }
     if (optind != argc) {
-        usage(argc, argv);
+        usage(argv[0]);
         exit(1);
     }
     nfds = 1;