diff options
author | earwin <[email protected]> | 2022-02-10 16:51:51 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:51:51 +0300 |
commit | a1e678842b5411fd2702d0495a01feb479043baa (patch) | |
tree | ab7fbbf3253d4c0e2793218f09378908beb025fb /util/system/datetime.cpp | |
parent | 77e5f5b6f9765d5dd8c47e7011c9d09d6237f4aa (diff) |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util/system/datetime.cpp')
-rw-r--r-- | util/system/datetime.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/util/system/datetime.cpp b/util/system/datetime.cpp index 2585c12a2b8..b07b50679a6 100644 --- a/util/system/datetime.cpp +++ b/util/system/datetime.cpp @@ -23,19 +23,19 @@ static ui64 ToMicroSeconds(const struct timeval& tv) { #if defined(_win_) static ui64 ToMicroSeconds(const FILETIME& ft) { - return (((ui64)ft.dwHighDateTime << 32) + (ui64)ft.dwLowDateTime) / (ui64)10; -} + return (((ui64)ft.dwHighDateTime << 32) + (ui64)ft.dwLowDateTime) / (ui64)10; +} #elif defined(Y_HAS_CLOCK_GETTIME) static ui64 ToMicroSeconds(const struct timespec& ts) { return (ui64)ts.tv_sec * 1000000 + (ui64)ts.tv_nsec / 1000; } -#endif - +#endif + ui64 MicroSeconds() noexcept { struct timeval tv; gettimeofday(&tv, nullptr); - return ToMicroSeconds(tv); + return ToMicroSeconds(tv); } ui64 ThreadCPUUserTime() noexcept { @@ -64,9 +64,9 @@ ui64 ThreadCPUTime() noexcept { GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, &kernelTime, &userTime); return ToMicroSeconds(userTime) + ToMicroSeconds(kernelTime); #elif defined(Y_HAS_CLOCK_GETTIME) - struct timespec ts; - clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); - return ToMicroSeconds(ts); + struct timespec ts; + clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); + return ToMicroSeconds(ts); #else return 0; #endif |