diff options
author | yulika <yulika@yandex-team.ru> | 2022-02-10 16:49:32 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:32 +0300 |
commit | 813282c045b159678a92f011f98acb00c3a416c6 (patch) | |
tree | b634da3ebb4fd06892b54d19b2334aab685c3ae4 | |
parent | 287c6c9d6962bf1bc8eae9a503b4971f31fca365 (diff) | |
download | ydb-813282c045b159678a92f011f98acb00c3a416c6.tar.gz |
Restoring authorship annotation for <yulika@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | library/cpp/timezone_conversion/civil.cpp | 60 | ||||
-rw-r--r-- | library/cpp/timezone_conversion/civil.h | 26 | ||||
-rw-r--r-- | library/cpp/timezone_conversion/ut/civil_ut.cpp | 12 |
3 files changed, 49 insertions, 49 deletions
diff --git a/library/cpp/timezone_conversion/civil.cpp b/library/cpp/timezone_conversion/civil.cpp index 5986318b9a..c78f79ae70 100644 --- a/library/cpp/timezone_conversion/civil.cpp +++ b/library/cpp/timezone_conversion/civil.cpp @@ -92,36 +92,36 @@ namespace NDatetime { TInstant Convert(const TCivilSecond& tp, const TTimeZone& tz) { return TInstant::Seconds(cctz::convert(tp, tz).time_since_epoch().count()); } - - TCivilSecond AddYears(const TCivilSecond& tp, TDiff diff) { - TCivilYear newYear = Calc<TCivilYear>(tp, diff); - return NDatetime::TCivilSecond(newYear.year(), tp.month(), tp.day(), tp.hour(), tp.minute(), tp.second()); - } - - TCivilSecond AddMonths(const TCivilSecond& tp, TDiff diff) { - TCivilMonth newMonth = Calc<TCivilMonth>(tp, diff); - return NDatetime::TCivilSecond(newMonth.year(), newMonth.month(), tp.day(), tp.hour(), tp.minute(), tp.second()); - } - - TCivilSecond AddDays(const TCivilSecond& tp, TDiff diff) { - TCivilDay newDay = Calc<TCivilDay>(tp, diff); - return NDatetime::TCivilSecond(newDay.year(), newDay.month(), newDay.day(), tp.hour(), tp.minute(), tp.second()); - } - - TCivilSecond AddHours(const TCivilSecond& tp, TDiff diff) { - TCivilHour newHour = Calc<TCivilHour>(tp, diff); - return NDatetime::TCivilSecond(newHour.year(), newHour.month(), newHour.day(), newHour.hour(), tp.minute(), tp.second()); - } - - TCivilSecond AddMinutes(const TCivilSecond& tp, TDiff diff) { - TCivilMinute newMinute = Calc<TCivilMinute>(tp, diff); - return NDatetime::TCivilSecond(newMinute.year(), newMinute.month(), newMinute.day(), newMinute.hour(), newMinute.minute(), tp.second()); - } - - TCivilSecond AddSeconds(const TCivilSecond& tp, TDiff diff) { - return Calc<TCivilSecond>(tp, diff); - } - + + TCivilSecond AddYears(const TCivilSecond& tp, TDiff diff) { + TCivilYear newYear = Calc<TCivilYear>(tp, diff); + return NDatetime::TCivilSecond(newYear.year(), tp.month(), tp.day(), tp.hour(), tp.minute(), tp.second()); + } + + TCivilSecond AddMonths(const TCivilSecond& tp, TDiff diff) { + TCivilMonth newMonth = Calc<TCivilMonth>(tp, diff); + return NDatetime::TCivilSecond(newMonth.year(), newMonth.month(), tp.day(), tp.hour(), tp.minute(), tp.second()); + } + + TCivilSecond AddDays(const TCivilSecond& tp, TDiff diff) { + TCivilDay newDay = Calc<TCivilDay>(tp, diff); + return NDatetime::TCivilSecond(newDay.year(), newDay.month(), newDay.day(), tp.hour(), tp.minute(), tp.second()); + } + + TCivilSecond AddHours(const TCivilSecond& tp, TDiff diff) { + TCivilHour newHour = Calc<TCivilHour>(tp, diff); + return NDatetime::TCivilSecond(newHour.year(), newHour.month(), newHour.day(), newHour.hour(), tp.minute(), tp.second()); + } + + TCivilSecond AddMinutes(const TCivilSecond& tp, TDiff diff) { + TCivilMinute newMinute = Calc<TCivilMinute>(tp, diff); + return NDatetime::TCivilSecond(newMinute.year(), newMinute.month(), newMinute.day(), newMinute.hour(), newMinute.minute(), tp.second()); + } + + TCivilSecond AddSeconds(const TCivilSecond& tp, TDiff diff) { + return Calc<TCivilSecond>(tp, diff); + } + TCivilSecond AddCivil(const TCivilSecond& tp, TCivilDiff diff) { switch (diff.Unit) { case ECivilUnit::Second: { diff --git a/library/cpp/timezone_conversion/civil.h b/library/cpp/timezone_conversion/civil.h index 0e95b807ed..fcb83647f0 100644 --- a/library/cpp/timezone_conversion/civil.h +++ b/library/cpp/timezone_conversion/civil.h @@ -145,7 +145,7 @@ namespace NDatetime { /** Just to simply calculations between dates/times. * NDatetime::Calc<TCivilDay>(TCivilSecond(2001, 1, 1, 10, 10, 10), 5); // returns TCivilDay(2001, 1, 6); - * @param[in] tp is a timepoint with which calc will be + * @param[in] tp is a timepoint with which calc will be * @param[in] diff is quantity of which will be added (of type T) to the tp * @return the calculated T type */ @@ -154,18 +154,18 @@ namespace NDatetime { return T(tp) + diff; } - /** Non-template methods for adding dates/times. - * @param[in] tp is a timepoint with which calc will be - * @param[in] diff is quantity of which will be added to the tp - * @return the calculated TCivilSecond object - */ - TCivilSecond AddYears(const TCivilSecond& tp, TDiff diff); - TCivilSecond AddMonths(const TCivilSecond& tp, TDiff diff); - TCivilSecond AddDays(const TCivilSecond& tp, TDiff diff); - TCivilSecond AddHours(const TCivilSecond& tp, TDiff diff); - TCivilSecond AddMinutes(const TCivilSecond& tp, TDiff diff); - TCivilSecond AddSeconds(const TCivilSecond& tp, TDiff diff); - + /** Non-template methods for adding dates/times. + * @param[in] tp is a timepoint with which calc will be + * @param[in] diff is quantity of which will be added to the tp + * @return the calculated TCivilSecond object + */ + TCivilSecond AddYears(const TCivilSecond& tp, TDiff diff); + TCivilSecond AddMonths(const TCivilSecond& tp, TDiff diff); + TCivilSecond AddDays(const TCivilSecond& tp, TDiff diff); + TCivilSecond AddHours(const TCivilSecond& tp, TDiff diff); + TCivilSecond AddMinutes(const TCivilSecond& tp, TDiff diff); + TCivilSecond AddSeconds(const TCivilSecond& tp, TDiff diff); + /** Method to add TCivilDiff * @param[in] tp is a timepoint with which calc will be * @param[in] diff is quantity of which will be added to the tp diff --git a/library/cpp/timezone_conversion/ut/civil_ut.cpp b/library/cpp/timezone_conversion/ut/civil_ut.cpp index a21bd4bd7d..47246d1f2d 100644 --- a/library/cpp/timezone_conversion/ut/civil_ut.cpp +++ b/library/cpp/timezone_conversion/ut/civil_ut.cpp @@ -22,12 +22,12 @@ Y_UNIT_TEST_SUITE(DateTime) { UNIT_ASSERT_VALUES_EQUAL(NDatetime::Calc<NDatetime::TCivilDay>(s, -2), NDatetime::TCivilDay(2017, 1, 30)); } Y_UNIT_TEST(Adds) { - NDatetime::TCivilSecond s(2017, 2, 1, 10, 12, 9); - UNIT_ASSERT_VALUES_EQUAL(NDatetime::AddDays(s, 2), NDatetime::TCivilSecond(2017, 2, 3, 10, 12, 9)); - UNIT_ASSERT_VALUES_EQUAL(NDatetime::AddMonths(s, -2), NDatetime::TCivilSecond(2016, 12, 1, 10, 12, 9)); - UNIT_ASSERT_VALUES_EQUAL(NDatetime::AddYears(s, -55), NDatetime::TCivilSecond(1962, 2, 1, 10, 12, 9)); - UNIT_ASSERT_VALUES_EQUAL(NDatetime::AddHours(s, 40), NDatetime::TCivilSecond(2017, 2, 3, 2, 12, 9)); - } + NDatetime::TCivilSecond s(2017, 2, 1, 10, 12, 9); + UNIT_ASSERT_VALUES_EQUAL(NDatetime::AddDays(s, 2), NDatetime::TCivilSecond(2017, 2, 3, 10, 12, 9)); + UNIT_ASSERT_VALUES_EQUAL(NDatetime::AddMonths(s, -2), NDatetime::TCivilSecond(2016, 12, 1, 10, 12, 9)); + UNIT_ASSERT_VALUES_EQUAL(NDatetime::AddYears(s, -55), NDatetime::TCivilSecond(1962, 2, 1, 10, 12, 9)); + UNIT_ASSERT_VALUES_EQUAL(NDatetime::AddHours(s, 40), NDatetime::TCivilSecond(2017, 2, 3, 2, 12, 9)); + } Y_UNIT_TEST(Convert) { TInstant absTime = TInstant::Seconds(1500299239); NDatetime::TTimeZone lax = NDatetime::GetTimeZone("America/Los_Angeles"); |