include unistd.h for getopt

Use settimeofday on non-android platforms.
diff --git a/date.c b/date.c
index 13b5210..47c044a 100644
--- a/date.c
+++ b/date.c
@@ -4,7 +4,10 @@
 #include <string.h>
 #include <errno.h>
 #include <time.h>
+#include <unistd.h>
+#ifndef NO_ANDROID_HEADERS
 #include <linux/android_alarm.h>
+#endif
 
 static void settime(char *s) {
     struct tm tm;
@@ -13,6 +16,7 @@
     time_t t;
     int fd;
     struct timespec ts;
+    struct timeval tv;
 
     while (*s && *s != '.')
         s++;
@@ -32,10 +36,16 @@
 
     t = mktime(&tm);
     
+#ifdef ANDROID_ALARM_SET_RTC
     fd = open("/dev/alarm", O_RDWR);
     ts.tv_sec = t;
     ts.tv_nsec = 0;
     ioctl(fd, ANDROID_ALARM_SET_RTC, &ts);
+#else
+    tv.tv_sec = t;
+    tv.tv_usec = 0;
+    (void) settimeofday(&tv, NULL);
+#endif
 }
 
 int date_main(int argc, char *argv[])
@@ -113,11 +123,14 @@
         //tv.tv_usec = 0;
         strtotimeval(argv[optind], &tv);
         printf("time %s -> %d.%d\n", argv[optind], tv.tv_sec, tv.tv_usec);
+#ifdef ANDROID_ALARM_SET_RTC
         fd = open("/dev/alarm", O_RDWR);
         ts.tv_sec = tv.tv_sec;
         ts.tv_nsec = tv.tv_usec * 1000;
         res = ioctl(fd, ANDROID_ALARM_SET_RTC, &ts);
-        //res = settimeofday(&tv, NULL);
+#else
+        res = settimeofday(&tv, NULL);
+#endif
         if(res < 0) {
             fprintf(stderr,"settimeofday failed %s\n", strerror(errno));
             return 1;