[libc] [Obvious] Fix.
GitOrigin-RevId: 80bea4a0d58178e3077bc320282d4cdf07e9c1ca
diff --git a/src/time/mktime.cpp b/src/time/mktime.cpp
index 3e0d06f..a352cc6 100644
--- a/src/time/mktime.cpp
+++ b/src/time/mktime.cpp
@@ -16,6 +16,9 @@
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);
@@ -198,7 +201,7 @@
// 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++;
diff --git a/src/time/time_utils.h b/src/time/time_utils.h
index 00cc399..48bbf7a 100644
--- a/src/time/time_utils.h
+++ b/src/time/time_utils.h
@@ -50,9 +50,6 @@
// 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;
};