giuliomoro@135: #include "Clock.h" giuliomoro@135: giuliomoro@135: namespace Clock giuliomoro@135: { giuliomoro@136: #ifdef USE_JUCE giuliomoro@136: myClock_t getTimeUs(){ giuliomoro@136: struct timeval tv; giuliomoro@136: struct timezone tz; giuliomoro@136: int ret=gettimeofday(&tv, &tz); giuliomoro@136: if(ret == -1){ giuliomoro@136: printf("Error while getting time of the day\n"); giuliomoro@136: return -1; giuliomoro@136: } giuliomoro@136: myClock_t time=tv.tv_usec + tv.tv_sec*1e6; giuliomoro@136: // printf("Time is: %.6f\n", time/1000000.0); giuliomoro@136: // printf("Time is: %lld\n", time); giuliomoro@136: return time; giuliomoro@136: } giuliomoro@136: #else giuliomoro@136: myClock_t getTimeUs(){ giuliomoro@136: return (myClock_t)((rt_timer_read()+500)/1000); giuliomoro@136: } giuliomoro@136: #endif /* USE_JUCE */ giuliomoro@136: };