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 | 52faf709473af8421da1e2ea84ae1879b16665b8 (patch) | |
tree | 2ec4264cfbc5e294ea04a7b12b9fa0b41f4d96ce /util/datetime | |
parent | eec632e483ae34bc211138c67434b1e0e6054ced (diff) | |
download | ydb-52faf709473af8421da1e2ea84ae1879b16665b8.tar.gz |
Restoring authorship annotation for <xpahos@yandex-team.ru>. Commit 1 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 38ecc3ab96..21489991b3 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 5e902b8f63..767db27643 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 afc3f802eb..34bab1ff00 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 |