diff options
author | kimkim <kimkim@yandex-team.ru> | 2022-02-10 16:49:27 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:27 +0300 |
commit | 13f84424ed9975f6827d9786087c6fe6ea265cda (patch) | |
tree | b94acc282c49a5de96b9e3e19feead21736f3273 /util/datetime | |
parent | 35f29a67a6b8e50e1826c837330086049114c5ba (diff) | |
download | ydb-13f84424ed9975f6827d9786087c6fe6ea265cda.tar.gz |
Restoring authorship annotation for <kimkim@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/datetime')
-rw-r--r-- | util/datetime/base.h | 2 | ||||
-rw-r--r-- | util/datetime/base_ut.cpp | 28 | ||||
-rw-r--r-- | util/datetime/parser_ut.cpp | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/util/datetime/base.h b/util/datetime/base.h index 5e902b8f63..138dee9ae1 100644 --- a/util/datetime/base.h +++ b/util/datetime/base.h @@ -8,7 +8,7 @@ #include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/ylimits.h> -#include <util/generic/utility.h> +#include <util/generic/utility.h> #include <util/generic/typetraits.h> #include <util/generic/yexception.h> diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp index afc3f802eb..b0aa67541e 100644 --- a/util/datetime/base_ut.cpp +++ b/util/datetime/base_ut.cpp @@ -6,7 +6,7 @@ #include <util/generic/ylimits.h> #include <util/generic/ymath.h> #include <util/string/cast.h> -#include <util/stream/output.h> +#include <util/stream/output.h> #include <util/system/compat.h> #include <util/random/random.h> @@ -29,9 +29,9 @@ struct TTestTime { Tm_.tm_year = 101; Tm_.tm_wday = 4; Tm_.tm_yday = 108; - } + } }; - + namespace { inline void OldDate8601(char* buf, time_t when) { struct tm theTm; @@ -197,20 +197,20 @@ Y_UNIT_TEST_SUITE(TDateTimeTest) { ui64 mcrsecB = MicroSeconds(); struct timeval tvB; gettimeofday(&tvB, nullptr); - + usleep(100000); - + ui64 mlsecA = millisec(); ui64 mcrsecA = MicroSeconds(); struct timeval tvA; gettimeofday(&tvA, nullptr); - + UNIT_ASSERT(mlsecB + 90 < mlsecA); UNIT_ASSERT((mcrsecB + 90000 < mcrsecA)); //UNIT_ASSERT(ToMicroSeconds(&tvB) + 90000 < ToMicroSeconds(&tvA)); //UNIT_ASSERT(TVdiff(tvB, tvA) == long(ToMicroSeconds(&tvA) - ToMicroSeconds(&tvB))); } - + Y_UNIT_TEST(TestCompatFuncs) { struct tm t; struct tm* tret = nullptr; @@ -218,7 +218,7 @@ Y_UNIT_TEST_SUITE(TDateTimeTest) { tret = gmtime_r(&e.T_, &t); UNIT_ASSERT(tret == &t); UNIT_ASSERT(CompareTM(e.Tm_, t)); - + /* * strptime seems to be broken on Mac OS X: * @@ -240,16 +240,16 @@ Y_UNIT_TEST_SUITE(TDateTimeTest) { time_t t3 = timegm(&t); UNIT_ASSERT(t3 == e.T_); } - + Y_UNIT_TEST(TestSprintSscan) { char buf[256]; long secs; TTestTime e; - + sprint_gm_date(buf, e.T_, &secs); UNIT_ASSERT(strcmp(buf, e.SprintDate_) == 0); UNIT_ASSERT(secs == e.SprintSecs_); - + struct tm t; Zero(t); bool ret = sscan_date(buf, t); @@ -258,12 +258,12 @@ Y_UNIT_TEST_SUITE(TDateTimeTest) { t.tm_year == e.Tm_.tm_year && t.tm_mon == e.Tm_.tm_mon && t.tm_mday == e.Tm_.tm_mday); - + buf[0] = 'a'; ret = sscan_date(buf, t); UNIT_ASSERT(!ret); } - + Y_UNIT_TEST(TestNow) { i64 seconds = Seconds(); i64 milliseconds = millisec(); @@ -337,7 +337,7 @@ Y_UNIT_TEST_SUITE(TDateTimeTest) { } } } - + Y_UNIT_TEST_SUITE(DateTimeTest) { Y_UNIT_TEST(TestDurationFromFloat) { UNIT_ASSERT_EQUAL(TDuration::MilliSeconds(500), TDuration::Seconds(0.5)); diff --git a/util/datetime/parser_ut.cpp b/util/datetime/parser_ut.cpp index 61364af997..59aaa6ca08 100644 --- a/util/datetime/parser_ut.cpp +++ b/util/datetime/parser_ut.cpp @@ -139,7 +139,7 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) { } else if (ch >= 'N' && ch <= 'Y') { return -(ch - 'N' + 1) * SECONDS_PER_HOUR; } else { - ythrow yexception() << "Invalid military zone."; + ythrow yexception() << "Invalid military zone."; } } |