aboutsummaryrefslogtreecommitdiffstats
path: root/util/datetime
diff options
context:
space:
mode:
authorpkalinnikov <pkalinnikov@yandex-team.ru>2022-02-10 16:50:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:15 +0300
commitd507a9366b2ab84411afe63fea9fba5498891e1b (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/datetime
parent9e33e026829d561d6fd46d72b88c367952e08075 (diff)
downloadydb-d507a9366b2ab84411afe63fea9fba5498891e1b.tar.gz
Restoring authorship annotation for <pkalinnikov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/datetime')
-rw-r--r--util/datetime/parser.rl64
-rw-r--r--util/datetime/parser_ut.cpp20
2 files changed, 12 insertions, 12 deletions
diff --git a/util/datetime/parser.rl6 b/util/datetime/parser.rl6
index 1f5e430c5c..931f09eae1 100644
--- a/util/datetime/parser.rl6
+++ b/util/datetime/parser.rl6
@@ -773,8 +773,8 @@ bool TDurationParser::ParsePart(const char* input, size_t len) {
return cs != %%{ write error; }%%;
}
-static inline ui64 DecPower(ui64 part, i32 power) {
- if (power >= 0)
+static inline ui64 DecPower(ui64 part, i32 power) {
+ if (power >= 0)
return part * Power(10, power);
return part / Power(10, -power);
}
diff --git a/util/datetime/parser_ut.cpp b/util/datetime/parser_ut.cpp
index 7c031e46a7..61364af997 100644
--- a/util/datetime/parser_ut.cpp
+++ b/util/datetime/parser_ut.cpp
@@ -587,11 +587,11 @@ Y_UNIT_TEST_SUITE(TDurationParseTest) {
UNIT_ASSERT_VALUES_EQUAL(TDuration::MilliSeconds(7196400), TDuration::Parse("1.999h"));
UNIT_ASSERT_VALUES_EQUAL(TDuration::MilliSeconds(7199640), TDuration::Parse("1.9999h"));
- UNIT_ASSERT_EQUAL(TDuration::Minutes(15), TDuration::Parse("15m"));
- UNIT_ASSERT_EQUAL(TDuration::Hours(10), TDuration::Parse("10h"));
- UNIT_ASSERT_EQUAL(TDuration::Days(365), TDuration::Parse("365d"));
- UNIT_ASSERT_EQUAL(TDuration::Hours(36), TDuration::Parse("1.5d"));
-
+ UNIT_ASSERT_EQUAL(TDuration::Minutes(15), TDuration::Parse("15m"));
+ UNIT_ASSERT_EQUAL(TDuration::Hours(10), TDuration::Parse("10h"));
+ UNIT_ASSERT_EQUAL(TDuration::Days(365), TDuration::Parse("365d"));
+ UNIT_ASSERT_EQUAL(TDuration::Hours(36), TDuration::Parse("1.5d"));
+
UNIT_ASSERT_VALUES_EQUAL(TDuration::Hours(24), TDuration::Parse("1d"));
UNIT_ASSERT_VALUES_EQUAL(TDuration::Hours(36), TDuration::Parse("1.5d"));
UNIT_ASSERT_VALUES_EQUAL(TDuration::Minutes(2448), TDuration::Parse("1.7d"));
@@ -618,10 +618,10 @@ Y_UNIT_TEST_SUITE(TDurationParseTest) {
UNIT_ASSERT_VALUES_EQUAL(TDuration::Seconds(112), TDuration::Parse("112"));
UNIT_ASSERT_VALUES_EQUAL(TDuration::MicroSeconds(14456), TDuration::Parse("14456us"));
-
- UNIT_ASSERT_VALUES_EQUAL(TDuration::MicroSeconds(1), TDuration::Parse("1000ns"));
- UNIT_ASSERT_VALUES_EQUAL(TDuration::MicroSeconds(1), TDuration::Parse("0.000001s"));
-
- UNIT_ASSERT_EQUAL(TDuration(), TDuration::Parse("10ns")); // TDuration has 1us precision.
+
+ UNIT_ASSERT_VALUES_EQUAL(TDuration::MicroSeconds(1), TDuration::Parse("1000ns"));
+ UNIT_ASSERT_VALUES_EQUAL(TDuration::MicroSeconds(1), TDuration::Parse("0.000001s"));
+
+ UNIT_ASSERT_EQUAL(TDuration(), TDuration::Parse("10ns")); // TDuration has 1us precision.
}
}