diff --git a/cmAudioFileDev.c b/cmAudioFileDev.c index b5a4610..cad96f9 100644 --- a/cmAudioFileDev.c +++ b/cmAudioFileDev.c @@ -8,16 +8,7 @@ #include "cmThread.h" #include "cmAudioPort.h" #include "cmAudioFileDev.h" - - -#ifdef OS_OSX -#include "osx/clock_gettime_stub.h" -#endif - -#ifdef OS_LINUX -#include // clock_gettime() -#endif - +#include "cmTime.h" cmAfdH_t cmAfdNullHandle = cmSTATIC_NULL_HANDLE; @@ -148,7 +139,7 @@ bool _cmAudioDevThreadFunc(void* param) if( p->cycleCnt == 0 ) { // get the baseTime - all other times will be relative to this time - clock_gettime(CLOCK_REALTIME,&p->baseTime); + cmTimeGet(&p->baseTime); p->nextTime = p->baseTime; p->nextTime.tv_sec = 0; _cmAfdIncrNextTime(p); @@ -158,7 +149,7 @@ bool _cmAudioDevThreadFunc(void* param) if( p->runFl ) { // get the current time as an offset from baseTime. - clock_gettime(CLOCK_REALTIME,&t0); + cmTimeGet(&t0); t0.tv_sec -= p->baseTime.tv_sec; // get length of time to next exec point diff --git a/cmMidiFilePlay.c b/cmMidiFilePlay.c index e761d9b..0912208 100644 --- a/cmMidiFilePlay.c +++ b/cmMidiFilePlay.c @@ -12,14 +12,8 @@ #include "cmMidiFile.h" #include "cmMidiFilePlay.h" #include "cmThread.h" // cmSleepUs() +#include "cmTime.h" -#ifdef OS_OSX -#include "osx/clock_gettime_stub.h" -#endif - -#ifdef OS_LINUX -#include // clock_gettime() -#endif typedef struct { @@ -286,7 +280,7 @@ void _cmMfpTestTimer() // t0 will be the base time which all other times will be // set relative to. - clock_gettime(CLOCK_REALTIME,&t0); + cmTimeGet(&t0); t2 = t0; t2.tv_sec = 0; @@ -295,7 +289,7 @@ void _cmMfpTestTimer() cmSleepUs(suspendUsecs); - clock_gettime(CLOCK_REALTIME,&t1); + cmTimeGet(&t1); t1.tv_sec -= t0.tv_sec; unsigned d0usec = _cmMfpElapsedMicroSecs(&t0,&t1); @@ -350,7 +344,7 @@ cmMfpRC_t cmMfpTest( const char* fn, cmCtx_t* ctx ) if((rc = cmMfpSeek( mfpH, 60 * 1000000 )) != kOkMfpRC ) goto errLabel; - clock_gettime(CLOCK_REALTIME,&base); + cmTimeGet(&base); t0 = base; t0.tv_sec = 0; @@ -359,7 +353,7 @@ cmMfpRC_t cmMfpTest( const char* fn, cmCtx_t* ctx ) { cmSleepUs(suspendUsecs); - clock_gettime(CLOCK_REALTIME,&t1); + cmTimeGet(&t1); t1.tv_sec -= base.tv_sec; unsigned dusecs = _cmMfpElapsedMicroSecs(&t0,&t1);