Skip to content

Date Time

include/time/date_time.h View source View on GitHub
TODO

timezones and functions related to this once anything needs this

struct date_time (3 fields) source

We use this one for storage

§ year_t year
§ day_t day
§ uint32_t sec
struct date_time_zone (2 fields) source
§ int16_t utc_offset_min
§ int16_t dst_offset_min
struct date_time_expanded (7 fields) source

We use this one for processing

§ year_t year
§ uint8_t month

0 - 11

§ uint8_t day_of_month

1 - 31

§ uint8_t day_of_week

0 - 6

§ uint8_t hour

0 - 23

§ uint8_t minute

0 - 59

§ uint8_t second

0 - 59

typedef uint16_t year_t
source

We’ll define these because this header + the implementations for various functions using struct date_time will need the annotations in types

typedef uint16_t day_t
source
bool is_leap_year(year_t year)
source
uint32_t days_in_month(int year, int month)
source
NOTE

month is 1-12 here

struct date_time_expanded date_time_expand(const struct date_time *dt)
source
void date_time_compact(
    const struct date_time_expanded *expanded,
    struct date_time *out
)
source