diff options
author | yu-semichev <yu-semichev@yandex-team.ru> | 2022-02-10 16:51:59 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:51:59 +0300 |
commit | 94e36d78a926cbf80bd9a2ac1ce171ebfc52bc39 (patch) | |
tree | 2e68574905010bd7faf33d6e4db80ba73f6bfec2 /util/draft | |
parent | d38a76c277aac50b05eadee93aec4a6effb12e91 (diff) | |
download | ydb-94e36d78a926cbf80bd9a2ac1ce171ebfc52bc39.tar.gz |
Restoring authorship annotation for <yu-semichev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/draft')
-rw-r--r-- | util/draft/date.cpp | 20 | ||||
-rw-r--r-- | util/draft/date.h | 4 | ||||
-rw-r--r-- | util/draft/date_ut.cpp | 6 |
3 files changed, 15 insertions, 15 deletions
diff --git a/util/draft/date.cpp b/util/draft/date.cpp index a290c46050..95197c4d79 100644 --- a/util/draft/date.cpp +++ b/util/draft/date.cpp @@ -72,16 +72,16 @@ TDate::TDate(unsigned year, unsigned month, unsigned monthDay) { } } -time_t TDate::GetStartUTC() const { - tm dateTm; - localtime_r(&Timestamp, &dateTm); - dateTm.tm_isdst = -1; - dateTm.tm_sec = 0; - dateTm.tm_min = 0; - dateTm.tm_hour = 0; - return TimeGM(&dateTm); -} - +time_t TDate::GetStartUTC() const { + tm dateTm; + localtime_r(&Timestamp, &dateTm); + dateTm.tm_isdst = -1; + dateTm.tm_sec = 0; + dateTm.tm_min = 0; + dateTm.tm_hour = 0; + return TimeGM(&dateTm); +} + TString TDate::ToStroka(const char* format) const { tm dateTm; localtime_r(&Timestamp, &dateTm); diff --git a/util/draft/date.h b/util/draft/date.h index e3eb616fe5..73ce8bcbff 100644 --- a/util/draft/date.h +++ b/util/draft/date.h @@ -38,8 +38,8 @@ public: return Timestamp; } - time_t GetStartUTC() const; - + time_t GetStartUTC() const; + TString ToStroka(const char* format = "%Y%m%d") const; TDate& operator++() { diff --git a/util/draft/date_ut.cpp b/util/draft/date_ut.cpp index 8c33a6c1cf..f937ae4de5 100644 --- a/util/draft/date_ut.cpp +++ b/util/draft/date_ut.cpp @@ -13,7 +13,7 @@ Y_UNIT_TEST_SUITE(TDateTest) { UNIT_ASSERT_EQUAL(d.ToStroka(), "20110215"); UNIT_ASSERT_EQUAL(d.ToStroka("%Y--%m--%d"), "2011--02--15"); UNIT_ASSERT_EQUAL(d.ToStroka("%U"), "07"); - UNIT_ASSERT_EQUAL(d.GetStartUTC(), 1297728000); + UNIT_ASSERT_EQUAL(d.GetStartUTC(), 1297728000); } { TDate d(2005, 6, 3); @@ -22,7 +22,7 @@ Y_UNIT_TEST_SUITE(TDateTest) { UNIT_ASSERT_EQUAL(d.GetMonthDay(), 3); UNIT_ASSERT_EQUAL(d.ToStroka(), "20050603"); UNIT_ASSERT_EQUAL(d.ToStroka("____%Y__%m____%d"), "____2005__06____03"); - UNIT_ASSERT_EQUAL(d.GetStartUTC(), 1117756800); + UNIT_ASSERT_EQUAL(d.GetStartUTC(), 1117756800); } { TDate d("2011-02-15", "%Y-%m-%d"); @@ -30,7 +30,7 @@ Y_UNIT_TEST_SUITE(TDateTest) { UNIT_ASSERT_EQUAL(d.GetMonth(), 2); UNIT_ASSERT_EQUAL(d.GetMonthDay(), 15); UNIT_ASSERT_EQUAL(d.ToStroka("%Y%m%d"), "20110215"); - UNIT_ASSERT_EQUAL(d.GetStartUTC(), 1297728000); + UNIT_ASSERT_EQUAL(d.GetStartUTC(), 1297728000); } } } |