51 "Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat" 63 if ( ( tm_year % 4 ) == 0 )
65 if ( ( tm_year % 100 ) == 0 )
67 if ( ( tm_year % 400 ) == 100 )
82 leap_years += ( tm_year / 4 );
83 leap_years -= ( tm_year / 100 );
84 leap_years += ( ( tm_year + 300 ) / 400 );
96 static int day_of_week (
int tm_year,
int tm_mon,
int tm_mday ) {
98 { 1, 4, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 };
99 int pseudo_year = tm_year;
104 offset[tm_mon] + tm_mday ) % 7 );
109 { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
118 int days_since_epoch;
119 int seconds_since_day;
139 DBGC ( &
weekdays,
"TIME %04d-%02d-%02d %02d:%02d:%02d => %lld (%s, " static int day_of_week(int tm_year, int tm_mon, int tm_mday)
Calculate day of week.
int tm_min
Minutes [0,59].
int tm_mday
Day of month [1,31].
int tm_year
Years since 1900.
static int is_leap_year(int tm_year)
Determine whether or not year is a leap year.
signed long time_offset
Current system clock offset.
int tm_mon
Month of year [0,11].
time_t mktime(struct tm *tm)
Calculate seconds since the Epoch.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
int tm_wday
Day of week [0,6] (Sunday=0)
int tm_yday
Day of year [0,365].
static const char * weekdays[]
Days of week (for debugging)
static int leap_years_to_end(int tm_year)
Calculate number of leap years since 1900.
UINT16_t seconds
Elapsed time.
int tm_sec
Seconds [0,60].
uint16_t offset
Offset to command line.
static const uint16_t days_to_month_start[]
Days from start of year until start of months (in non-leap years)
int64_t time_t
Seconds since the Epoch.