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 | |
parent | 52faf709473af8421da1e2ea84ae1879b16665b8 (diff) | |
download | ydb-da8fe75e5a837ef6a6e8a21f96dcee631e8b5a1e.tar.gz |
Restoring authorship annotation for <xpahos@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-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 | ||||
-rw-r--r-- | util/network/socket.cpp | 14 | ||||
-rw-r--r-- | util/system/fstat.cpp | 4 | ||||
-rw-r--r-- | util/system/fstat_ut.cpp | 2 |
6 files changed, 36 insertions, 36 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 diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 619b555e4a..4f6e804346 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -5,7 +5,7 @@ #include "iovec.h" #include <util/system/defaults.h> -#include <util/system/byteorder.h> +#include <util/system/byteorder.h> #if defined(_unix_) #include <netdb.h> @@ -957,13 +957,13 @@ namespace { } inline bool IsLocalName(const char* name) const noexcept { - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - + struct sockaddr_in sa; + memset(&sa, 0, sizeof(sa)); + if (inet_pton(AF_INET, name, &(sa.sin_addr)) == 1) { - return (InetToHost(sa.sin_addr.s_addr) >> 24) == 127; - } - + return (InetToHost(sa.sin_addr.s_addr) >> 24) == 127; + } + return contains(name); } }; diff --git a/util/system/fstat.cpp b/util/system/fstat.cpp index 5ee7930a90..81e98cbc6b 100644 --- a/util/system/fstat.cpp +++ b/util/system/fstat.cpp @@ -55,7 +55,7 @@ static void MakeStat(TFileStat& st, const TSystemFStat& fs) { st.ATime = fs.st_atime; st.MTime = fs.st_mtime; st.CTime = fs.st_ctime; - st.INode = fs.st_ino; + st.INode = fs.st_ino; #else timeval tv; FileTimeToTimeval(&fs.ftCreationTime, &tv); @@ -70,7 +70,7 @@ static void MakeStat(TFileStat& st, const TSystemFStat& fs) { st.Gid = 0; st.Size = ((ui64)fs.nFileSizeHigh << 32) | fs.nFileSizeLow; st.AllocationSize = st.Size; // FIXME - st.INode = ((ui64)fs.nFileIndexHigh << 32) | fs.nFileIndexLow; + st.INode = ((ui64)fs.nFileIndexHigh << 32) | fs.nFileIndexLow; #endif } diff --git a/util/system/fstat_ut.cpp b/util/system/fstat_ut.cpp index 9502d11c7d..160ecd936e 100644 --- a/util/system/fstat_ut.cpp +++ b/util/system/fstat_ut.cpp @@ -42,7 +42,7 @@ Y_UNIT_TEST_SUITE(TestFileStat) { UNIT_ASSERT_VALUES_EQUAL(cFs.Mode, oFs.Mode); UNIT_ASSERT_VALUES_EQUAL(cFs.Uid, oFs.Uid); UNIT_ASSERT_VALUES_EQUAL(cFs.Gid, oFs.Gid); - UNIT_ASSERT_VALUES_EQUAL(cFs.INode, oFs.INode); + UNIT_ASSERT_VALUES_EQUAL(cFs.INode, oFs.INode); UNIT_ASSERT(unlink(fileName.data()) == 0); } |