@@ -16,17 +16,20 @@ using namespace platform::core;
1616#else
1717 #define LARGE_INTEGER long
1818#endif
19- #if defined(__ORBIS__) | defined(__COMMODORE__)
20- #include < perf.h>
21- static uint64_t performanceCounter ()
19+ #if defined(__ORBIS__) || defined(__COMMODORE__) || defined(UNIX)
20+ #include < time.h>
21+ #if defined(__ORBIS__)
22+ #include < perf.h>
23+ #endif
24+ static uint64_t performanceCounter ()
2225 {
2326 uint64_t result = 0 ;
2427 timespec ts;
2528 clock_gettime (CLOCK_MONOTONIC, &ts);
2629 result = (uint64_t )ts.tv_sec * 1000000000LL + (uint64_t )ts.tv_nsec ;
2730 return result;
2831 }
29- uint64_t performanceFrequency ()
32+ static uint64_t performanceFrequency ()
3033 {
3134 uint64_t result = 1 ;
3235 result = 1000000000LL ;
@@ -84,8 +87,8 @@ void Timer::StartTime()
8487 LARGE_INTEGER &tStart=*(reinterpret_cast <LARGE_INTEGER*>(&iStart));
8588 QueryPerformanceCounter (&tStart);
8689#endif
87- #if defined(__ORBIS__) | defined(__COMMODORE__)
88- iStart=( double ) performanceCounter ();
90+ #if defined(__ORBIS__) || defined(__COMMODORE__) || defined(UNIX )
91+ iStart=performanceCounter ();
8992#endif
9093}
9194
@@ -101,8 +104,8 @@ float Timer::FinishTime()
101104 Time=((float )(tStop.QuadPart -tStart.QuadPart -Oht))/(float )dPerfFreq;
102105 TimeSum+=Time;
103106#endif
104- #if defined(__ORBIS__) | defined(__COMMODORE__)
105- iStop=( double ) performanceCounter ();
107+ #if defined(__ORBIS__) || defined(__COMMODORE__) || defined(UNIX )
108+ iStop=performanceCounter ();
106109 Time=(float )(1000.0 *(double )(iStop-iStart)/(double )performanceFrequency ());
107110 iStart=iStop;
108111 TimeSum+=Time;
@@ -122,7 +125,7 @@ float Timer::AbsoluteTimeMS()
122125 else
123126 t=((float )(tStop.QuadPart -tStart.QuadPart ))/(float )dPerfFreq;
124127#endif
125- #ifdef __ORBIS__
128+ #if defined( __ORBIS__) || defined(__COMMODORE__) || defined(UNIX)
126129 return (float )(1000.0 *(double )performanceCounter ()/(double )performanceFrequency ());
127130#endif
128131 return t;
0 commit comments