aboutsummaryrefslogtreecommitdiffstats
path: root/util/datetime
diff options
context:
space:
mode:
authorluxaeterna <luxaeterna@yandex-team.ru>2022-02-10 16:50:13 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:13 +0300
commit2c76d348a3be51f0875ddeaad6b2ccda604dee0f (patch)
tree054cd500011b8b97634220fc570d32a1d45fcc35 /util/datetime
parent9f848110233b3807d5dd3ae5479b3957d791892c (diff)
downloadydb-2c76d348a3be51f0875ddeaad6b2ccda604dee0f.tar.gz
Restoring authorship annotation for <luxaeterna@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/datetime')
-rw-r--r--util/datetime/parser.h4
-rw-r--r--util/datetime/parser.rl64
-rw-r--r--util/datetime/parser_ut.cpp60
3 files changed, 34 insertions, 34 deletions
diff --git a/util/datetime/parser.h b/util/datetime/parser.h
index f0c1b4a0c7..0c3b6dc570 100644
--- a/util/datetime/parser.h
+++ b/util/datetime/parser.h
@@ -53,8 +53,8 @@ struct TDateTimeFields {
if (Minute > 59)
return false;
- // handle leap second which is explicitly allowed by ISO 8601:2004(E) $2.2.2
- // https://datatracker.ietf.org/doc/html/rfc3339#section-5.6
+ // handle leap second which is explicitly allowed by ISO 8601:2004(E) $2.2.2
+ // https://datatracker.ietf.org/doc/html/rfc3339#section-5.6
if (Second > 60)
return false;
diff --git a/util/datetime/parser.rl6 b/util/datetime/parser.rl6
index 931f09eae1..f36b6de219 100644
--- a/util/datetime/parser.rl6
+++ b/util/datetime/parser.rl6
@@ -206,14 +206,14 @@ secondFrac = digit {1,6} >clear_int $update_int @{
}
DateTimeFields.MicroSecond = us;
};
-secondFracTail = (digit*);
+secondFracTail = (digit*);
zoneZ = [Zz] @set_zone_utc;
zoneOffset = space? . ('+' | '-') >{ Sign = fc == '+' ? 1 : -1; } . int2 @{ DateTimeFields.ZoneOffsetMinutes = Sign * (i32)TDuration::Hours(I).Minutes(); } . (':')? . (int2 @{ DateTimeFields.ZoneOffsetMinutes += I * Sign; })?;
zone = zoneZ | zoneOffset;
iso8601date = (year . '-' . month . '-' . day) | (year . month . day);
-iso8601time = (hour . ':' . minute . (':' . second ('.' secondFrac secondFracTail)?)?) | (hour . minute . second?);
+iso8601time = (hour . ':' . minute . (':' . second ('.' secondFrac secondFracTail)?)?) | (hour . minute . second?);
iso8601datetime = iso8601date . ([Tt ] . iso8601time . zone?)?;
diff --git a/util/datetime/parser_ut.cpp b/util/datetime/parser_ut.cpp
index 61364af997..5946fbbc05 100644
--- a/util/datetime/parser_ut.cpp
+++ b/util/datetime/parser_ut.cpp
@@ -421,36 +421,36 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) {
TInstant::Seconds(1253317023) + TDuration::MicroSeconds(12331));
}
- Y_UNIT_TEST(TestIso8601FractionsBelowMicro) {
- UNIT_ASSERT_VALUES_EQUAL(
- TInstant::ParseIso8601("1970-01-01 00:00:00.0000000+00:00"),
- TInstant::Seconds(0));
- UNIT_ASSERT_VALUES_EQUAL(
- TInstant::ParseIso8601("1970-01-01 00:00:00.0000009+00:00"),
- TInstant::Seconds(0));
- UNIT_ASSERT_VALUES_EQUAL(
- TInstant::ParseIso8601("1970-01-01 00:00:00.000000789+00:00"),
- TInstant::Seconds(0));
- UNIT_ASSERT_VALUES_EQUAL(
- TInstant::ParseIso8601("1970-01-01 00:00:00.1234560+00:00"),
- TInstant::Seconds(0) + TDuration::MicroSeconds(123456));
- UNIT_ASSERT_VALUES_EQUAL(
- TInstant::ParseIso8601("1970-01-01 00:00:00.1234569+00:00"),
- TInstant::Seconds(0) + TDuration::MicroSeconds(123456));
- UNIT_ASSERT_VALUES_EQUAL(
- TInstant::ParseIso8601("1970-01-01 00:00:00.123456789+00:00"),
- TInstant::Seconds(0) + TDuration::MicroSeconds(123456));
- UNIT_ASSERT_VALUES_EQUAL(
- TInstant::ParseIso8601("1970-01-01 00:00:00.9999990+00:00"),
- TInstant::Seconds(0) + TDuration::MicroSeconds(999999));
- UNIT_ASSERT_VALUES_EQUAL(
- TInstant::ParseIso8601("1970-01-01 00:00:00.9999999+00:00"),
- TInstant::Seconds(0) + TDuration::MicroSeconds(999999));
- UNIT_ASSERT_VALUES_EQUAL(
- TInstant::ParseIso8601("1970-01-01 00:00:00.999999789+00:00"),
- TInstant::Seconds(0) + TDuration::MicroSeconds(999999));
- }
-
+ Y_UNIT_TEST(TestIso8601FractionsBelowMicro) {
+ UNIT_ASSERT_VALUES_EQUAL(
+ TInstant::ParseIso8601("1970-01-01 00:00:00.0000000+00:00"),
+ TInstant::Seconds(0));
+ UNIT_ASSERT_VALUES_EQUAL(
+ TInstant::ParseIso8601("1970-01-01 00:00:00.0000009+00:00"),
+ TInstant::Seconds(0));
+ UNIT_ASSERT_VALUES_EQUAL(
+ TInstant::ParseIso8601("1970-01-01 00:00:00.000000789+00:00"),
+ TInstant::Seconds(0));
+ UNIT_ASSERT_VALUES_EQUAL(
+ TInstant::ParseIso8601("1970-01-01 00:00:00.1234560+00:00"),
+ TInstant::Seconds(0) + TDuration::MicroSeconds(123456));
+ UNIT_ASSERT_VALUES_EQUAL(
+ TInstant::ParseIso8601("1970-01-01 00:00:00.1234569+00:00"),
+ TInstant::Seconds(0) + TDuration::MicroSeconds(123456));
+ UNIT_ASSERT_VALUES_EQUAL(
+ TInstant::ParseIso8601("1970-01-01 00:00:00.123456789+00:00"),
+ TInstant::Seconds(0) + TDuration::MicroSeconds(123456));
+ UNIT_ASSERT_VALUES_EQUAL(
+ TInstant::ParseIso8601("1970-01-01 00:00:00.9999990+00:00"),
+ TInstant::Seconds(0) + TDuration::MicroSeconds(999999));
+ UNIT_ASSERT_VALUES_EQUAL(
+ TInstant::ParseIso8601("1970-01-01 00:00:00.9999999+00:00"),
+ TInstant::Seconds(0) + TDuration::MicroSeconds(999999));
+ UNIT_ASSERT_VALUES_EQUAL(
+ TInstant::ParseIso8601("1970-01-01 00:00:00.999999789+00:00"),
+ TInstant::Seconds(0) + TDuration::MicroSeconds(999999));
+ }
+
Y_UNIT_TEST(TestIso8601BigDate) {
TVector<std::pair<TString, int>> dates{
{"2019-01-01", 17897},