diff options
author | spacelord <spacelord@yandex-team.ru> | 2022-02-10 16:48:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:15 +0300 |
commit | a0c6d9ad0cf6b94c527a15da147eb24335281b6d (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /util/datetime | |
parent | 16747e4f77455cca4932df21eb76f12cb0a97a5c (diff) | |
download | ydb-a0c6d9ad0cf6b94c527a15da147eb24335281b6d.tar.gz |
Restoring authorship annotation for <spacelord@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/datetime')
-rw-r--r-- | util/datetime/base.h | 20 | ||||
-rw-r--r-- | util/datetime/base_ut.cpp | 10 |
2 files changed, 15 insertions, 15 deletions
diff --git a/util/datetime/base.h b/util/datetime/base.h index 9746cc9d1c..5e902b8f63 100644 --- a/util/datetime/base.h +++ b/util/datetime/base.h @@ -96,7 +96,7 @@ TString YearToString(time_t when); template <class S> class TTimeBase { public: - using TValue = ui64; + using TValue = ui64; protected: constexpr TTimeBase(const TValue& value) noexcept @@ -178,22 +178,22 @@ protected: namespace NDateTimeHelpers { template <typename T> struct TPrecisionHelper { - using THighPrecision = ui64; + using THighPrecision = ui64; }; template <> struct TPrecisionHelper<float> { - using THighPrecision = double; + using THighPrecision = double; }; template <> struct TPrecisionHelper<double> { - using THighPrecision = double; + using THighPrecision = double; }; } class TDuration: public TTimeBase<TDuration> { - using TBase = TTimeBase<TDuration>; + using TBase = TTimeBase<TDuration>; private: /** @@ -348,7 +348,7 @@ struct THash<TDuration> { /// TInstant and TDuration are guaranteed to have same precision class TInstant: public TTimeBase<TInstant> { - using TBase = TTimeBase<TInstant>; + using TBase = TTimeBase<TInstant>; private: /** @@ -411,11 +411,11 @@ public: return Seconds(m * 60); } - /// hours since epoch + /// hours since epoch static constexpr TInstant Hours(ui64 h) noexcept { - return Minutes(h * 60); - } - + return Minutes(h * 60); + } + /// days since epoch static constexpr TInstant Days(ui64 d) noexcept { return Hours(d * 24); diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp index d7fef849db..afc3f802eb 100644 --- a/util/datetime/base_ut.cpp +++ b/util/datetime/base_ut.cpp @@ -447,7 +447,7 @@ Y_UNIT_TEST_SUITE(DateTimeTest) { // division UNIT_ASSERT_DOUBLES_EQUAL(TDuration::Minutes(1) / TDuration::Seconds(10), 6.0, 1e-9); } - + Y_UNIT_TEST(TestDurationGetters) { const TDuration value = TDuration::MicroSeconds(1234567); UNIT_ASSERT_VALUES_EQUAL(value.Seconds(), 1); @@ -466,23 +466,23 @@ Y_UNIT_TEST_SUITE(DateTimeTest) { T onlyHours = T::MicroSeconds(1249570800000000L); T onlyDays = T::MicroSeconds(1249516800000000L); ui64 minutes = 20826199; - ui64 hours = 347103; + ui64 hours = 347103; ui64 days = 14462; UNIT_ASSERT_VALUES_EQUAL(withTime.Minutes(), minutes); UNIT_ASSERT_VALUES_EQUAL(onlyMinutes, T::Minutes(minutes)); UNIT_ASSERT_VALUES_EQUAL(onlyMinutes.Minutes(), minutes); - UNIT_ASSERT_VALUES_EQUAL(withTime.Hours(), hours); + UNIT_ASSERT_VALUES_EQUAL(withTime.Hours(), hours); UNIT_ASSERT_VALUES_EQUAL(onlyMinutes.Hours(), hours); UNIT_ASSERT_VALUES_EQUAL(onlyHours, T::Hours(hours)); - UNIT_ASSERT_VALUES_EQUAL(onlyHours.Hours(), hours); + UNIT_ASSERT_VALUES_EQUAL(onlyHours.Hours(), hours); UNIT_ASSERT_VALUES_EQUAL(withTime.Days(), days); UNIT_ASSERT_VALUES_EQUAL(onlyHours.Days(), days); UNIT_ASSERT_VALUES_EQUAL(onlyDays, T::Days(days)); UNIT_ASSERT_VALUES_EQUAL(onlyDays.Days(), days); - } + } Y_UNIT_TEST(TestInstantUnits) { TestTimeUnits<TInstant>(); |