diff options
author | rzhikharevich <rzhikharevich@yandex-team.ru> | 2022-02-10 16:51:00 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:51:00 +0300 |
commit | 724861a587a9d8ecec238aec4c37154e3f2409bb (patch) | |
tree | 4efb7811cde0cc9f95a48040cc3a9b26775c6dae /util | |
parent | 7b34adcce01173502f056f3a5053d8ca47945b76 (diff) | |
download | ydb-724861a587a9d8ecec238aec4c37154e3f2409bb.tar.gz |
Restoring authorship annotation for <rzhikharevich@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/system/datetime.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/util/system/datetime.cpp b/util/system/datetime.cpp index b07b50679a..ad2c8c376f 100644 --- a/util/system/datetime.cpp +++ b/util/system/datetime.cpp @@ -8,15 +8,15 @@ #include <ctime> #include <cerrno> -#ifdef _darwin_ +#ifdef _darwin_ #include <AvailabilityMacros.h> #if defined(MAC_OS_X_VERSION_10_12) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12 #define Y_HAS_CLOCK_GETTIME #endif -#elif defined(_linux_) || defined(_freebsd_) || defined(_cygwin_) +#elif defined(_linux_) || defined(_freebsd_) || defined(_cygwin_) #define Y_HAS_CLOCK_GETTIME -#endif - +#endif + static ui64 ToMicroSeconds(const struct timeval& tv) { return (ui64)tv.tv_sec * 1000000 + (ui64)tv.tv_usec; } @@ -25,10 +25,10 @@ static ui64 ToMicroSeconds(const struct timeval& tv) { static ui64 ToMicroSeconds(const FILETIME& ft) { 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; -} +#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 ui64 MicroSeconds() noexcept { @@ -63,12 +63,12 @@ ui64 ThreadCPUTime() noexcept { FILETIME creationTime, exitTime, kernelTime, userTime; GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, &kernelTime, &userTime); return ToMicroSeconds(userTime) + ToMicroSeconds(kernelTime); -#elif defined(Y_HAS_CLOCK_GETTIME) +#elif defined(Y_HAS_CLOCK_GETTIME) struct timespec ts; clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); return ToMicroSeconds(ts); -#else - return 0; +#else + return 0; #endif } @@ -97,7 +97,7 @@ void NanoSleep(ui64 ns) noexcept { #if defined(_x86_) extern const bool HaveRdtscp = NX86::HaveRDTSCP(); #endif - -#ifdef Y_HAS_CLOCK_GETTIME + +#ifdef Y_HAS_CLOCK_GETTIME #undef Y_HAS_CLOCK_GETTIME -#endif +#endif |