|
Lines 77-83
Link Here
|
| 77 |
#if OS_WIN |
77 |
#if OS_WIN |
| 78 |
// whrt_Time starts at zero, nothing needs to be done. |
78 |
// whrt_Time starts at zero, nothing needs to be done. |
| 79 |
#elif HAVE_CLOCK_GETTIME |
79 |
#elif HAVE_CLOCK_GETTIME |
| 80 |
(void)clock_gettime(CLOCK_REALTIME, &start); |
80 |
(void)clock_gettime(CLOCK_MONOTONIC, &start); |
| 81 |
#elif HAVE_GETTIMEOFDAY |
81 |
#elif HAVE_GETTIMEOFDAY |
| 82 |
gettimeofday(&start, 0); |
82 |
gettimeofday(&start, 0); |
| 83 |
#endif |
83 |
#endif |
|
Lines 104-110
Link Here
|
| 104 |
#elif HAVE_CLOCK_GETTIME |
104 |
#elif HAVE_CLOCK_GETTIME |
| 105 |
ENSURE(start.tv_sec || start.tv_nsec); // must have called timer_LatchStartTime first |
105 |
ENSURE(start.tv_sec || start.tv_nsec); // must have called timer_LatchStartTime first |
| 106 |
struct timespec cur; |
106 |
struct timespec cur; |
| 107 |
(void)clock_gettime(CLOCK_REALTIME, &cur); |
107 |
(void)clock_gettime(CLOCK_MONOTONIC, &cur); |
| 108 |
t = (cur.tv_sec - start.tv_sec) + (cur.tv_nsec - start.tv_nsec)*1e-9; |
108 |
t = (cur.tv_sec - start.tv_sec) + (cur.tv_nsec - start.tv_nsec)*1e-9; |
| 109 |
#elif HAVE_GETTIMEOFDAY |
109 |
#elif HAVE_GETTIMEOFDAY |
| 110 |
ENSURE(start.tv_sec || start.tv_usec); // must have called timer_LatchStartTime first |
110 |
ENSURE(start.tv_sec || start.tv_usec); // must have called timer_LatchStartTime first |
|
Lines 129-135
Link Here
|
| 129 |
resolution = whrt_Resolution(); |
129 |
resolution = whrt_Resolution(); |
| 130 |
#elif HAVE_CLOCK_GETTIME |
130 |
#elif HAVE_CLOCK_GETTIME |
| 131 |
struct timespec ts; |
131 |
struct timespec ts; |
| 132 |
if(clock_getres(CLOCK_REALTIME, &ts) == 0) |
132 |
if(clock_getres(CLOCK_MONOTONIC, &ts) == 0) |
| 133 |
resolution = ts.tv_nsec * 1e-9; |
133 |
resolution = ts.tv_nsec * 1e-9; |
| 134 |
#else |
134 |
#else |
| 135 |
const double t0 = timer_Time(); |
135 |
const double t0 = timer_Time(); |