diff core/Clock.cpp @ 135:e77e2e712fbc ClockSync

To work with the ClockSync plugin
author Giulio Moro <giuliomoro@yahoo.it>
date Sat, 12 Sep 2015 20:05:55 +0100
parents
children 772dbb57442b
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/Clock.cpp	Sat Sep 12 20:05:55 2015 +0100
@@ -0,0 +1,18 @@
+#include "Clock.h"
+
+namespace Clock
+{
+  myClock_t getTimeUs(){
+    struct timeval tv;
+    struct timezone tz;
+    int ret=gettimeofday(&tv, &tz);
+    if(ret == -1){
+       printf("Error while getting time of the day\n");
+      return -1;
+    }
+    myClock_t time=tv.tv_usec + tv.tv_sec*1e6;
+    //   printf("Time is: %.6f\n", time/1000000.0);
+    //   printf("Time is: %lld\n", time);
+    return time;
+  }
+};
\ No newline at end of file