init: Move gettime() to util.c

Change-Id: I1df96964763f8baedbc1cea6875d3dfc5e48c065
diff --git a/init/init.c b/init/init.c
index ba2c0d3..008c513 100755
--- a/init/init.c
+++ b/init/init.c
@@ -25,7 +25,6 @@
 #include <sys/mount.h>
 #include <sys/stat.h>
 #include <sys/poll.h>
-#include <time.h>
 #include <errno.h>
 #include <stdarg.h>
 #include <mtd/mtd-user.h>
@@ -119,24 +118,6 @@
     close(fd);
 }
 
-/*
- * gettime() - returns the time in seconds of the system's monotonic clock or
- * zero on error.
- */
-static time_t gettime(void)
-{
-    struct timespec ts;
-    int ret;
-
-    ret = clock_gettime(CLOCK_MONOTONIC, &ts);
-    if (ret < 0) {
-        ERROR("clock_gettime(CLOCK_MONOTONIC) failed: %s\n", strerror(errno));
-        return 0;
-    }
-
-    return ts.tv_sec;
-}
-
 static void publish_socket(const char *name, int fd)
 {
     char key[64] = ANDROID_SOCKET_ENV_PREFIX;
diff --git a/init/init.h b/init/init.h
index 2d18b9e..8210238 100644
--- a/init/init.h
+++ b/init/init.h
@@ -25,6 +25,7 @@
                   uid_t uid, gid_t gid);
 
 void *read_file(const char *fn, unsigned *_sz);
+time_t gettime(void);
 
 void log_init(void);
 void log_set_level(int level);
diff --git a/init/util.c b/init/util.c
index 48f8d54..6f9a12e 100644
--- a/init/util.c
+++ b/init/util.c
@@ -21,6 +21,7 @@
 #include <fcntl.h>
 #include <ctype.h>
 #include <errno.h>
+#include <time.h>
 
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -280,3 +281,21 @@
     }
     return -1;
 }
+
+/*
+ * gettime() - returns the time in seconds of the system's monotonic clock or
+ * zero on error.
+ */
+time_t gettime(void)
+{
+    struct timespec ts;
+    int ret;
+
+    ret = clock_gettime(CLOCK_MONOTONIC, &ts);
+    if (ret < 0) {
+        ERROR("clock_gettime(CLOCK_MONOTONIC) failed: %s\n", strerror(errno));
+        return 0;
+    }
+
+    return ts.tv_sec;
+}