using __llvm_libc::time_utils::TimeConstants;
+static constexpr int NonLeapYearDaysInMonth[] = {31, 28, 31, 30, 31, 30,
+ 31, 31, 30, 31, 30, 31};
+
// Returns number of years from (1, year).
static constexpr int64_t getNumOfLeapYearsBefore(int64_t year) {
return (year / 4) - (year / 100) + (year / 400);
// Calculate total number of days based on the month and the day (tm_mday).
int64_t totalDays = tm_out->tm_mday - 1;
for (int64_t i = 0; i < month; ++i)
- totalDays += TimeConstants::NonLeapYearDaysInMonth[i];
+ totalDays += NonLeapYearDaysInMonth[i];
// Add one day if it is a leap year and the month is after February.
if (tmYearIsLeap && month > 1)
totalDays++;
// susceptible to the Year 2038 problem.
static constexpr int EndOf32BitEpochYear = 2038;
- static constexpr int NonLeapYearDaysInMonth[] = {31, 28, 31, 30, 31, 30, 30,
- 31, 31, 30, 31, 30, 31};
-
static constexpr time_t OutOfRangeReturnValue = -1;
};