aboutsummaryrefslogtreecommitdiff
path: root/src/timings.cpp
diff options
context:
space:
mode:
authorMorten Vassvik <mvassvik@gmail.com>2018-07-04 21:04:48 +0200
committerMorten Vassvik <mvassvik@gmail.com>2018-07-04 21:04:48 +0200
commit3b2c8678179a64c2e53e22a1dae50487fb8873e7 (patch)
tree9420c42c799c76bd023513b8157a3fb5197a07b6 /src/timings.cpp
parent3de23eb0bf9a14da89b6c5c143b5d4302c424bd1 (diff)
Replaced CLOCK_PROCESS_CPUTIME_ID with CLOCK_MONOTONIC in calls to clock_gettime and clock_getres to make timings on calling external executables accurate instead of showing them taking negligible time on linux.
Diffstat (limited to 'src/timings.cpp')
-rw-r--r--src/timings.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/timings.cpp b/src/timings.cpp
index 89280b779..3aea7a0fa 100644
--- a/src/timings.cpp
+++ b/src/timings.cpp
@@ -51,7 +51,7 @@ u64 osx_time_stamp__freq(void) {
u64 unix_time_stamp_time_now(void) {
struct timespec ts;
- clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
+ clock_gettime(CLOCK_MONOTONIC, &ts);
return (ts.tv_sec * 1000000000) + ts.tv_nsec;
}
@@ -61,7 +61,7 @@ u64 unix_time_stamp__freq(void) {
if (freq == 0) {
struct timespec ts;
- clock_getres(CLOCK_PROCESS_CPUTIME_ID, &ts);
+ clock_getres(CLOCK_MONOTONIC, &ts);
freq = cast(u64) ((1.0 / ts.tv_nsec) * 1000000000.0);
}