Sfoglia il codice sorgente

cmAudioFileDev.c,cmMidiFilePlay.c:Replaced calls to clock_gettime() with equivalent calls to cmTimeGet().

master
kevin 11 anni fa
parent
commit
0507290dfe
2 ha cambiato i file con 8 aggiunte e 23 eliminazioni
  1. 3
    12
      cmAudioFileDev.c
  2. 5
    11
      cmMidiFilePlay.c

+ 3
- 12
cmAudioFileDev.c Vedi File

@@ -8,16 +8,7 @@
8 8
 #include "cmThread.h"
9 9
 #include "cmAudioPort.h"
10 10
 #include "cmAudioFileDev.h"
11
-
12
-
13
-#ifdef OS_OSX
14
-#include "osx/clock_gettime_stub.h"
15
-#endif
16
-
17
-#ifdef OS_LINUX
18
-#include <time.h> // clock_gettime()
19
-#endif
20
-
11
+#include "cmTime.h"
21 12
 
22 13
 cmAfdH_t cmAfdNullHandle = cmSTATIC_NULL_HANDLE;
23 14
 
@@ -148,7 +139,7 @@ bool _cmAudioDevThreadFunc(void* param)
148 139
   if( p->cycleCnt == 0 )
149 140
   {
150 141
     // get the baseTime - all other times will be relative to this time
151
-    clock_gettime(CLOCK_REALTIME,&p->baseTime);
142
+    cmTimeGet(&p->baseTime);
152 143
     p->nextTime = p->baseTime;
153 144
     p->nextTime.tv_sec = 0;
154 145
     _cmAfdIncrNextTime(p);
@@ -158,7 +149,7 @@ bool _cmAudioDevThreadFunc(void* param)
158 149
   if( p->runFl )
159 150
   {
160 151
     // get the current time as an offset from baseTime.
161
-    clock_gettime(CLOCK_REALTIME,&t0);
152
+    cmTimeGet(&t0);
162 153
     t0.tv_sec -= p->baseTime.tv_sec;
163 154
 
164 155
     // get length of time to next exec point

+ 5
- 11
cmMidiFilePlay.c Vedi File

@@ -12,14 +12,8 @@
12 12
 #include "cmMidiFile.h"
13 13
 #include "cmMidiFilePlay.h"
14 14
 #include "cmThread.h" // cmSleepUs()
15
+#include "cmTime.h"
15 16
 
16
-#ifdef OS_OSX
17
-#include "osx/clock_gettime_stub.h"
18
-#endif
19
-
20
-#ifdef OS_LINUX
21
-#include <time.h> // clock_gettime()
22
-#endif
23 17
 
24 18
 typedef struct
25 19
 {
@@ -286,7 +280,7 @@ void _cmMfpTestTimer()
286 280
   
287 281
   // t0 will be the base time which all other times will be 
288 282
   // set relative to.
289
-  clock_gettime(CLOCK_REALTIME,&t0);
283
+  cmTimeGet(&t0);
290 284
   t2 = t0;
291 285
   t2.tv_sec = 0;
292 286
 
@@ -295,7 +289,7 @@ void _cmMfpTestTimer()
295 289
     cmSleepUs(suspendUsecs);
296 290
 
297 291
     
298
-    clock_gettime(CLOCK_REALTIME,&t1);
292
+    cmTimeGet(&t1);
299 293
     t1.tv_sec -= t0.tv_sec;
300 294
 
301 295
     unsigned d0usec = _cmMfpElapsedMicroSecs(&t0,&t1);
@@ -350,7 +344,7 @@ cmMfpRC_t cmMfpTest( const char* fn, cmCtx_t* ctx )
350 344
   if((rc = cmMfpSeek( mfpH, 60 * 1000000 )) != kOkMfpRC )
351 345
     goto errLabel;
352 346
 
353
-  clock_gettime(CLOCK_REALTIME,&base);
347
+  cmTimeGet(&base);
354 348
   t0 = base;
355 349
   t0.tv_sec = 0;
356 350
 
@@ -359,7 +353,7 @@ cmMfpRC_t cmMfpTest( const char* fn, cmCtx_t* ctx )
359 353
   {
360 354
     cmSleepUs(suspendUsecs);
361 355
     
362
-    clock_gettime(CLOCK_REALTIME,&t1);    
356
+    cmTimeGet(&t1);    
363 357
     t1.tv_sec -= base.tv_sec;
364 358
 
365 359
     unsigned dusecs = _cmMfpElapsedMicroSecs(&t0,&t1);

Loading…
Annulla
Salva