mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
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.
This commit is contained in:
+2
-2
@@ -51,7 +51,7 @@ u64 osx_time_stamp__freq(void) {
|
|||||||
|
|
||||||
u64 unix_time_stamp_time_now(void) {
|
u64 unix_time_stamp_time_now(void) {
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
||||||
return (ts.tv_sec * 1000000000) + ts.tv_nsec;
|
return (ts.tv_sec * 1000000000) + ts.tv_nsec;
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ u64 unix_time_stamp__freq(void) {
|
|||||||
|
|
||||||
if (freq == 0) {
|
if (freq == 0) {
|
||||||
struct timespec ts;
|
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);
|
freq = cast(u64) ((1.0 / ts.tv_nsec) * 1000000000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user