]> mj.ucw.cz Git - osdd.git/blobdiff - util.c
osd-batt: Bugfix to previous commit
[osdd.git] / util.c
diff --git a/util.c b/util.c
index fdf8b76091f3a98571ca6681803525887159f0d9..f9cd0c2bc59a3da2502c1ca510e112c3d4fbaf54 100644 (file)
--- a/util.c
+++ b/util.c
@@ -7,8 +7,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#include <sys/time.h>
 
-#include "util.h"
+#include "osd.h"
 
 void __attribute__((noreturn)) __attribute__((format(printf,1,2)))
 die(char *fmt, ...)
@@ -29,3 +30,11 @@ xmalloc(int size)
     die("Failed to allocate %d bytes of memory", size);
   return p;
 }
+
+timestamp_t
+get_current_time(void)
+{
+  struct timeval tv;
+  gettimeofday(&tv, NULL);
+  return (timestamp_t) tv.tv_sec * 1000 + tv.tv_usec / 1000;
+}