# HG changeset patch # User Giulio Moro # Date 1442175998 -3600 # Node ID 772dbb57442b8db71e01a61ceda1ed736e28c8c4 # Parent e77e2e712fbc55e4a10be502d4a959a3a512c33d Implemented xenomai version of Clock diff -r e77e2e712fbc -r 772dbb57442b core/Clock.cpp --- a/core/Clock.cpp Sat Sep 12 20:05:55 2015 +0100 +++ b/core/Clock.cpp Sun Sep 13 21:26:38 2015 +0100 @@ -2,17 +2,23 @@ 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 +#ifdef USE_JUCE + 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; + } +#else + myClock_t getTimeUs(){ + return (myClock_t)((rt_timer_read()+500)/1000); + } +#endif /* USE_JUCE */ +};