diff --git a/Source/Time/AuClock.cpp b/Source/Time/AuClock.cpp index 46ef5d14..fb3f6ae9 100644 --- a/Source/Time/AuClock.cpp +++ b/Source/Time/AuClock.cpp @@ -211,16 +211,26 @@ namespace Aurora::Time AUKN_SYM AuUInt64 HighResClockMS() { #if defined(AURORA_IS_POSIX_DERIVED) - return SteadyClockMS(); + ::timespec spec {}; + if (::clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &spec) == 0) + { + return AuSToMS(spec.tv_sec) + AuNSToMS(spec.tv_nsec); + } #endif + return std::chrono::duration_cast(high_res_clock::now().time_since_epoch()).count(); } AUKN_SYM AuUInt64 HighResClockNS() { #if defined(AURORA_IS_POSIX_DERIVED) - return SteadyClockNS(); + ::timespec spec {}; + if (::clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &spec) == 0) + { + return AuMSToNS(AuSToMS(spec.tv_sec)) + (AuUInt64)spec.tv_nsec; + } #endif + return std::chrono::duration_cast(high_res_clock::now().time_since_epoch()).count(); } @@ -328,7 +338,7 @@ namespace Aurora::Time #if defined(AURORA_IS_POSIX_DERIVED) ::timespec spec {}; - if (::clock_getres(CLOCK_MONOTONIC, &spec) == 0) + if (::clock_getres(CLOCK_PROCESS_CPUTIME_ID, &spec) == 0) { if (spec.tv_nsec && !spec.tv_sec) {