aboutsummaryrefslogtreecommitdiffstats
path: root/util/draft/datetime.cpp
diff options
context:
space:
mode:
authorsobols <sobols@yandex-team.ru>2022-02-10 16:47:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:08 +0300
commit09961b69c61f471ddd594e0fd877df62a8021562 (patch)
tree54a7b60a9526a7104557a033eb0a8d70d64b604c /util/draft/datetime.cpp
parent4ce8835206f981afa4a61915a49a21fb750416ec (diff)
downloadydb-09961b69c61f471ddd594e0fd877df62a8021562.tar.gz
Restoring authorship annotation for <sobols@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/draft/datetime.cpp')
-rw-r--r--util/draft/datetime.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/util/draft/datetime.cpp b/util/draft/datetime.cpp
index 5cbe7d8847..aebbec25d3 100644
--- a/util/draft/datetime.cpp
+++ b/util/draft/datetime.cpp
@@ -17,25 +17,25 @@ namespace NDatetime {
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} //leap
};
- const ui32 MonthDaysNewYear[2][13] = {
- {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, //nleap
- {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} //leap
+ const ui32 MonthDaysNewYear[2][13] = {
+ {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, //nleap
+ {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} //leap
};
- void YDayToMonthAndDay(ui32 yday, bool isleap, ui32* month, ui32* mday) {
- const ui32* begin = MonthDaysNewYear[isleap] + 1;
- const ui32* end = begin + 12;
- // [31, ..., 365] or [31, ..., 366] (12 elements)
-
- const ui32* pos = UpperBound(begin, end, yday);
+ void YDayToMonthAndDay(ui32 yday, bool isleap, ui32* month, ui32* mday) {
+ const ui32* begin = MonthDaysNewYear[isleap] + 1;
+ const ui32* end = begin + 12;
+ // [31, ..., 365] or [31, ..., 366] (12 elements)
+
+ const ui32* pos = UpperBound(begin, end, yday);
Y_ENSURE(pos != end, "day no. " << yday << " does not exist in " << (isleap ? "leap" : "non-leap") << " year");
-
- *month = pos - begin;
- *mday = yday - *(pos - 1) + 1;
-
+
+ *month = pos - begin;
+ *mday = yday - *(pos - 1) + 1;
+
Y_ASSERT((*month < 12) && (1 <= *mday) && (*mday <= MonthDays[isleap][*month]));
- }
-
+ }
+
struct TTimeData {
i32 IsDst = 0;
i32 GMTOff = 0;