#ifndef H_UTIL #define H_UTIL #include #include #include #define ONE_MINUTE 60 #define ONE_HOUR (60 * ONE_MINUTE) #define ONE_DAY (24 * ONE_HOUR) void set_time(const struct tm *time); bool is_clock_24h(void); // A day of a month, either an exact day or a "nth X-day of month" struct month_relative_day { bool is_exact_day; union { uint8_t exact_day; struct { uint8_t weekday; // 0 = sunday, ..., 6 = saturday uint8_t weeknum; }; }; }; uint8_t get_exact_day(const struct month_relative_day *mrday, uint8_t month, uint24_t year); long lmax(long a, long b); #endif