diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/datetime/systime.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/datetime/systime.h')
-rw-r--r-- | util/datetime/systime.h | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/util/datetime/systime.h b/util/datetime/systime.h index 6e6ea58928..491d36e802 100644 --- a/util/datetime/systime.h +++ b/util/datetime/systime.h @@ -1,47 +1,47 @@ #pragma once -#include <util/system/platform.h> +#include <util/system/platform.h> #include <util/generic/string.h> - + #include <ctime> - + // timegm and gmtime_r versions that don't need access to filesystem or a big stack time_t TimeGM(const struct tm* t); -struct tm* GmTimeR(const time_t* timer, struct tm* tmbuf); +struct tm* GmTimeR(const time_t* timer, struct tm* tmbuf); // safe version of ctime, convinient version of ctime_r TString CTimeR(const time_t* timer); #ifdef _win_ - #include <util/system/winint.h> - #include <winsock2.h> + #include <util/system/winint.h> + #include <winsock2.h> -void FileTimeToTimeval(const FILETIME* ft, struct timeval* tv); +void FileTimeToTimeval(const FILETIME* ft, struct timeval* tv); -// obtains the current time, expressed as seconds and microseconds since 00:00 UTC, January 1, 1970 -int gettimeofday(struct timeval* tp, void*); +// obtains the current time, expressed as seconds and microseconds since 00:00 UTC, January 1, 1970 +int gettimeofday(struct timeval* tp, void*); -// thou should not mix these with non-_r functions -tm* localtime_r(const time_t* clock, tm* result); -tm* gmtime_r(const time_t* clock, tm* result); -char* ctime_r(const time_t* clock, char* buf); +// thou should not mix these with non-_r functions +tm* localtime_r(const time_t* clock, tm* result); +tm* gmtime_r(const time_t* clock, tm* result); +char* ctime_r(const time_t* clock, char* buf); -inline time_t timegm(struct tm* t) { - return TimeGM(t); -} +inline time_t timegm(struct tm* t) { + return TimeGM(t); +} -char* strptime(const char* buf, const char* fmt, struct tm* tm); // strptime.cpp +char* strptime(const char* buf, const char* fmt, struct tm* tm); // strptime.cpp #else - #include <sys/time.h> + #include <sys/time.h> #endif #ifndef timersub - #define timersub(tvp, uvp, vvp) \ - do { \ - (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ - (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ - if ((vvp)->tv_usec < 0) { \ - (vvp)->tv_sec--; \ - (vvp)->tv_usec += 1000000; \ - } \ - } while (0) + #define timersub(tvp, uvp, vvp) \ + do { \ + (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ + if ((vvp)->tv_usec < 0) { \ + (vvp)->tv_sec--; \ + (vvp)->tv_usec += 1000000; \ + } \ + } while (0) #endif |