Mercurial > hg > beaglert
comparison 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 |
comparison
equal
deleted
inserted
replaced
133:04b1678614c9 | 135:e77e2e712fbc |
---|---|
1 #include "Clock.h" | |
2 | |
3 namespace Clock | |
4 { | |
5 myClock_t getTimeUs(){ | |
6 struct timeval tv; | |
7 struct timezone tz; | |
8 int ret=gettimeofday(&tv, &tz); | |
9 if(ret == -1){ | |
10 printf("Error while getting time of the day\n"); | |
11 return -1; | |
12 } | |
13 myClock_t time=tv.tv_usec + tv.tv_sec*1e6; | |
14 // printf("Time is: %.6f\n", time/1000000.0); | |
15 // printf("Time is: %lld\n", time); | |
16 return time; | |
17 } | |
18 }; |