summaryrefslogtreecommitdiff
path: root/globals.c
diff options
context:
space:
mode:
Diffstat (limited to 'globals.c')
-rw-r--r--globals.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/globals.c b/globals.c
index c0be662..d66d730 100644
--- a/globals.c
+++ b/globals.c
@@ -1,5 +1,6 @@
#include "globals.h"
#include <time.h>
+#include <sys/time.h>
GlobalStruct globals = {
@@ -19,3 +20,16 @@ long sec_timer (void)
{
return (long)time(NULL);
}
+
+
+unsigned long long ms_timer (void)
+{
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+
+ unsigned long long millisecondsSinceEpoch =
+ (unsigned long long)(tv.tv_sec) * 1000 +
+ (unsigned long long)(tv.tv_usec) / 1000;
+
+ return millisecondsSinceEpoch;
+}