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 /library/cpp/timezone_conversion | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/timezone_conversion')
-rw-r--r-- | library/cpp/timezone_conversion/civil-inl.h | 28 | ||||
-rw-r--r-- | library/cpp/timezone_conversion/civil.cpp | 30 | ||||
-rw-r--r-- | library/cpp/timezone_conversion/civil.h | 2 | ||||
-rw-r--r-- | library/cpp/timezone_conversion/convert.cpp | 44 | ||||
-rw-r--r-- | library/cpp/timezone_conversion/ut/civil_ut.cpp | 4 | ||||
-rw-r--r-- | library/cpp/timezone_conversion/ut/convert_ut.cpp | 52 |
6 files changed, 80 insertions, 80 deletions
diff --git a/library/cpp/timezone_conversion/civil-inl.h b/library/cpp/timezone_conversion/civil-inl.h index 03c9de4ba0..32afbccb64 100644 --- a/library/cpp/timezone_conversion/civil-inl.h +++ b/library/cpp/timezone_conversion/civil-inl.h @@ -7,27 +7,27 @@ namespace NDatetime { template <typename T> struct TGetCivilUnit; - template <> + template <> struct TGetCivilUnit<TCivilSecond> { static constexpr ECivilUnit Value = ECivilUnit::Second; }; - template <> + template <> struct TGetCivilUnit<TCivilMinute> { static constexpr ECivilUnit Value = ECivilUnit::Minute; }; - template <> + template <> struct TGetCivilUnit<TCivilHour> { static constexpr ECivilUnit Value = ECivilUnit::Hour; }; - template <> + template <> struct TGetCivilUnit<TCivilDay> { static constexpr ECivilUnit Value = ECivilUnit::Day; }; - template <> + template <> struct TGetCivilUnit<TCivilMonth> { static constexpr ECivilUnit Value = ECivilUnit::Month; }; - template <> + template <> struct TGetCivilUnit<TCivilYear> { static constexpr ECivilUnit Value = ECivilUnit::Year; }; @@ -35,29 +35,29 @@ namespace NDatetime { template <ECivilUnit Unit> struct TGetCivilTime; - template <> + template <> struct TGetCivilTime<ECivilUnit::Second> { using TResult = TCivilSecond; }; - template <> + template <> struct TGetCivilTime<ECivilUnit::Minute> { using TResult = TCivilMinute; }; - template <> + template <> struct TGetCivilTime<ECivilUnit::Hour> { using TResult = TCivilHour; }; - template <> + template <> struct TGetCivilTime<ECivilUnit::Day> { using TResult = TCivilDay; }; - template <> + template <> struct TGetCivilTime<ECivilUnit::Month> { using TResult = TCivilMonth; }; - template <> + template <> struct TGetCivilTime<ECivilUnit::Year> { using TResult = TCivilYear; }; - } -} + } +} diff --git a/library/cpp/timezone_conversion/civil.cpp b/library/cpp/timezone_conversion/civil.cpp index 3cecf0b467..5986318b9a 100644 --- a/library/cpp/timezone_conversion/civil.cpp +++ b/library/cpp/timezone_conversion/civil.cpp @@ -177,7 +177,7 @@ namespace NDatetime { template <> void Out<NDatetime::TCivilYear>(IOutputStream& out, const NDatetime::TCivilYear& y) { - out << y.year(); + out << y.year(); } template <> @@ -209,26 +209,26 @@ template <> void Out<NDatetime::TWeekday>(IOutputStream& out, NDatetime::TWeekday wd) { using namespace cctz; switch (wd) { - case weekday::monday: + case weekday::monday: out << TStringBuf("Monday"); - break; - case weekday::tuesday: + break; + case weekday::tuesday: out << TStringBuf("Tuesday"); - break; - case weekday::wednesday: + break; + case weekday::wednesday: out << TStringBuf("Wednesday"); - break; - case weekday::thursday: + break; + case weekday::thursday: out << TStringBuf("Thursday"); - break; - case weekday::friday: + break; + case weekday::friday: out << TStringBuf("Friday"); - break; - case weekday::saturday: + break; + case weekday::saturday: out << TStringBuf("Saturday"); - break; - case weekday::sunday: + break; + case weekday::sunday: out << TStringBuf("Sunday"); - break; + break; } } diff --git a/library/cpp/timezone_conversion/civil.h b/library/cpp/timezone_conversion/civil.h index edcc428a78..0e95b807ed 100644 --- a/library/cpp/timezone_conversion/civil.h +++ b/library/cpp/timezone_conversion/civil.h @@ -58,7 +58,7 @@ namespace NDatetime { template <ECivilUnit Unit> struct TGetCivilTime; - } + } template <typename T> CONSTEXPR_M ECivilUnit GetCivilUnit(const T& = {}) { diff --git a/library/cpp/timezone_conversion/convert.cpp b/library/cpp/timezone_conversion/convert.cpp index e3b789a3dd..490bb4e270 100644 --- a/library/cpp/timezone_conversion/convert.cpp +++ b/library/cpp/timezone_conversion/convert.cpp @@ -26,27 +26,27 @@ namespace NDatetime { tm.IsLeap = LeapYearAD(cs.year()); switch (cctz::get_weekday(cd)) { - case cctz::weekday::monday: - tm.WDay = 1; - break; - case cctz::weekday::tuesday: - tm.WDay = 2; - break; - case cctz::weekday::wednesday: - tm.WDay = 3; - break; - case cctz::weekday::thursday: - tm.WDay = 4; - break; - case cctz::weekday::friday: - tm.WDay = 5; - break; - case cctz::weekday::saturday: - tm.WDay = 6; - break; - case cctz::weekday::sunday: - tm.WDay = 0; - break; + case cctz::weekday::monday: + tm.WDay = 1; + break; + case cctz::weekday::tuesday: + tm.WDay = 2; + break; + case cctz::weekday::wednesday: + tm.WDay = 3; + break; + case cctz::weekday::thursday: + tm.WDay = 4; + break; + case cctz::weekday::friday: + tm.WDay = 5; + break; + case cctz::weekday::saturday: + tm.WDay = 6; + break; + case cctz::weekday::sunday: + tm.WDay = 0; + break; } return tm; @@ -87,7 +87,7 @@ namespace NDatetime { civilTime.MDay, civilTime.Hour, civilTime.Min, - civilTime.Sec); + civilTime.Sec); return TInstant::Seconds(TSystemClock::to_time_t(tz.lookup(cs).pre)); } } diff --git a/library/cpp/timezone_conversion/ut/civil_ut.cpp b/library/cpp/timezone_conversion/ut/civil_ut.cpp index b2e29b6943..a21bd4bd7d 100644 --- a/library/cpp/timezone_conversion/ut/civil_ut.cpp +++ b/library/cpp/timezone_conversion/ut/civil_ut.cpp @@ -5,10 +5,10 @@ #include <util/stream/str.h> namespace NDatetime { - inline bool operator==(const NDatetime::TCivilDiff& x, const NDatetime::TCivilDiff& y) { + inline bool operator==(const NDatetime::TCivilDiff& x, const NDatetime::TCivilDiff& y) { return x.Unit == y.Unit && x.Value == y.Value; } -} +} template <> inline void Out<NDatetime::TCivilDiff>(IOutputStream& out, const NDatetime::TCivilDiff& diff) { diff --git a/library/cpp/timezone_conversion/ut/convert_ut.cpp b/library/cpp/timezone_conversion/ut/convert_ut.cpp index 477813e542..bbf9e9b826 100644 --- a/library/cpp/timezone_conversion/ut/convert_ut.cpp +++ b/library/cpp/timezone_conversion/ut/convert_ut.cpp @@ -29,11 +29,11 @@ void CompareCivilTimes(const TSimpleTM& expected, const TSimpleTM& actual) { } #define CHECK_ROUND_TRIP(tz, unixTime, civil) \ - EXPECT_EQ( \ - TInstant::Seconds(unixTime), \ - ToAbsoluteTime(civil, tz)); \ + EXPECT_EQ( \ + TInstant::Seconds(unixTime), \ + ToAbsoluteTime(civil, tz)); \ CompareCivilTimes( \ - civil, \ + civil, \ ToCivilTime(TInstant::Seconds(unixTime), tz)); // Tests only unambiguous civil times (i.e., those that occurred exactly once). @@ -41,35 +41,35 @@ TEST(TimeZoneConversion, Simple) { TTimeZone msk = GetTimeZone("Europe/Moscow"); // Before and after the temporary switch to UTC+3 in 2010. CHECK_ROUND_TRIP( - msk, - 1288475999, - ZonedTm(+4, true, 2010, 10, 31, 1, 59, 59)); + msk, + 1288475999, + ZonedTm(+4, true, 2010, 10, 31, 1, 59, 59)); CHECK_ROUND_TRIP( - msk, - 1288475999 + 3 * 60 * 60, - ZonedTm(+3, false, 2010, 10, 31, 3, 59, 59)); + msk, + 1288475999 + 3 * 60 * 60, + ZonedTm(+3, false, 2010, 10, 31, 3, 59, 59)); // Before and after the permanent switch to UTC+4 in 2011. CHECK_ROUND_TRIP( - msk, - 1301180399, - ZonedTm(+3, false, 2011, 3, 27, 1, 59, 59)); + msk, + 1301180399, + ZonedTm(+3, false, 2011, 3, 27, 1, 59, 59)); CHECK_ROUND_TRIP( - msk, - 1301180399 + 60 * 60, - ZonedTm(+4, false, 2011, 3, 27, 3, 59, 59)); + msk, + 1301180399 + 60 * 60, + ZonedTm(+4, false, 2011, 3, 27, 3, 59, 59)); // Some random moment between 2011 and 2014 when UTC+4 (no DST) was in place. CHECK_ROUND_TRIP( - msk, - 1378901234, - ZonedTm(+4, false, 2013, 9, 11, 16, 7, 14)); + msk, + 1378901234, + ZonedTm(+4, false, 2013, 9, 11, 16, 7, 14)); // As of right now (i.e., as I'm writing this) Moscow is in UTC+3 (no DST). CHECK_ROUND_TRIP( - msk, - 1458513396, - ZonedTm(+3, false, 2016, 3, 21, 1, 36, 36)); + msk, + 1458513396, + ZonedTm(+3, false, 2016, 3, 21, 1, 36, 36)); // Please add a new test if the current president moves Moscow back to UTC+4 // or introduces DST again. @@ -122,9 +122,9 @@ TEST(TimeZoneConversion, TestSkippedDate) { TEST(TimeZoneConversion, Utc) { CHECK_ROUND_TRIP( - GetUtcTimeZone(), - 1451703845, - ZonedTm(0, false, 2016, 1, 2, 3, 4, 5)); + GetUtcTimeZone(), + 1451703845, + ZonedTm(0, false, 2016, 1, 2, 3, 4, 5)); } TEST(TimeZoneConversion, Local) { @@ -182,7 +182,7 @@ TEST(TimeZoneConversion, TestFutureDstChanges) { // 31 days later we're back to UTC+0 again. CHECK_ROUND_TRIP( london, - 1760124660 + 31 * 24 * 60 * 60, + 1760124660 + 31 * 24 * 60 * 60, ZonedTm(+0, false, 2025, 11, 10, 19, 31, 0)); } |