diff options
author | xpahos <xpahos@yandex-team.ru> | 2022-02-10 16:47:21 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:21 +0300 |
commit | da8fe75e5a837ef6a6e8a21f96dcee631e8b5a1e (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /util/datetime | |
parent | 52faf709473af8421da1e2ea84ae1879b16665b8 (diff) | |
download | ydb-da8fe75e5a837ef6a6e8a21f96dcee631e8b5a1e.tar.gz |
Restoring authorship annotation for <xpahos@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/datetime')
-rw-r--r-- | util/datetime/base.cpp | 16 | ||||
-rw-r--r-- | util/datetime/base.h | 28 | ||||
-rw-r--r-- | util/datetime/base_ut.cpp | 8 |
3 files changed, 26 insertions, 26 deletions
diff --git a/util/datetime/base.cpp b/util/datetime/base.cpp index 21489991b3..38ecc3ab96 100644 --- a/util/datetime/base.cpp +++ b/util/datetime/base.cpp @@ -181,10 +181,10 @@ TString TInstant::ToString() const { return ::ToString(*this); } -TString TInstant::ToRfc822String() const { - return FormatGmTime("%a, %d %b %Y %H:%M:%S GMT"); -} - +TString TInstant::ToRfc822String() const { + return FormatGmTime("%a, %d %b %Y %H:%M:%S GMT"); +} + TString TInstant::ToStringUpToSeconds() const { char buf[64]; auto len = FormatDate8601(buf, sizeof(buf), TimeT()); @@ -202,10 +202,10 @@ TString TInstant::ToStringLocal() const { return ::ToString(FormatLocal(*this)); } -TString TInstant::ToRfc822StringLocal() const { - return FormatLocalTime("%a, %d %b %Y %H:%M:%S %Z"); -} - +TString TInstant::ToRfc822StringLocal() const { + return FormatLocalTime("%a, %d %b %Y %H:%M:%S %Z"); +} + TString TInstant::ToIsoStringLocalUpToSeconds() const { return ::ToString(FormatIsoLocalUpToSeconds(*this)); } diff --git a/util/datetime/base.h b/util/datetime/base.h index 767db27643..5e902b8f63 100644 --- a/util/datetime/base.h +++ b/util/datetime/base.h @@ -452,13 +452,13 @@ public: TString ToString() const; /** - * Formats the instant using the UTC time zone. - * - * @returns An RFC822 formatted string, e.g. 'Sun, 06 Nov 1994 08:49:37 GMT'. - */ - TString ToRfc822String() const; - - /** + * Formats the instant using the UTC time zone. + * + * @returns An RFC822 formatted string, e.g. 'Sun, 06 Nov 1994 08:49:37 GMT'. + */ + TString ToRfc822String() const; + + /** * Formats the instant using the UTC time zone, with second precision. * * @returns An ISO 8601 formatted string, e.g. '2015-11-21T23:30:27Z'. @@ -482,13 +482,13 @@ public: TString ToStringLocal() const; /** - * Formats the instant using the system time zone. - * - * @returns An RFC822 formatted string, e.g. 'Sun, 06 Nov 1994 08:49:37 MSK'. - */ - TString ToRfc822StringLocal() const; - - /** + * Formats the instant using the system time zone. + * + * @returns An RFC822 formatted string, e.g. 'Sun, 06 Nov 1994 08:49:37 MSK'. + */ + TString ToRfc822StringLocal() const; + + /** * Formats the instant using the system time zone, with second precision. * * @returns An ISO 8601 / RFC 3339 formatted string, diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp index 34bab1ff00..afc3f802eb 100644 --- a/util/datetime/base_ut.cpp +++ b/util/datetime/base_ut.cpp @@ -416,10 +416,10 @@ Y_UNIT_TEST_SUITE(DateTimeTest) { UNIT_ASSERT_VALUES_EQUAL(TString("2009-08-06T15:19:06Z"), (TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455)).ToStringUpToSeconds()); } - Y_UNIT_TEST(TestInstantToRfc822String) { - UNIT_ASSERT_VALUES_EQUAL(TString("Thu, 06 Aug 2009 15:19:06 GMT"), (TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455)).ToRfc822String()); - } - + Y_UNIT_TEST(TestInstantToRfc822String) { + UNIT_ASSERT_VALUES_EQUAL(TString("Thu, 06 Aug 2009 15:19:06 GMT"), (TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455)).ToRfc822String()); + } + Y_UNIT_TEST(TestInstantMath) { UNIT_ASSERT_VALUES_EQUAL(TInstant::Seconds(1719), TInstant::Seconds(1700) + TDuration::Seconds(19)); // overflow |