9static constexpr int32_t SECONDS_PER_DAY = 86400;
12static constexpr int MIN_VALID_YEAR = 2019;
13static constexpr time_t MIN_VALID_EPOCH = 1546300800;
31 const int wday = (days + 4) % 7;
32 return wday < 0 ? wday + 7 : wday;
41 if constexpr (
sizeof(time_t) >
sizeof(int32_t)) {
42 return epoch >= -62167219200LL && epoch < 2005949145600LL;
RP2040 wakeable delay uses file-scope state (alarm callback + flag) — defined in wake_rp2....
int days_before_month(int year, int month)
Days in the year before the first of a month (1-12)
bool is_leap_year(int year)
Check if a year is a leap year.
bool epoch_in_range(time_t epoch)
Whether a UTC epoch is in the years 0 to 65535, which the epoch functions below take without checking...
int days_in_month(int year, int month)
Get the number of days in a month (1-12)
int32_t days_to_year_start(int year)
Days from the epoch (Jan 1 1970) to Jan 1 of the given year.
int epoch_to_year(time_t epoch)
Get the year of a UTC epoch.
void epoch_to_tm_utc(time_t epoch, struct tm *out_tm)
Convert epoch to year/month/day/hour/min/sec (UTC)
constexpr int days_to_weekday(int32_t days)
Day of the week (0 = Sunday) of a day counted from the epoch, which may be negative.