iPXE
|
Date and time. More...
#include <time.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | is_leap_year (int tm_year) |
Determine whether or not year is a leap year. More... | |
static int | leap_years_to_end (int tm_year) |
Calculate number of leap years since 1900. More... | |
static int | day_of_week (int tm_year, int tm_mon, int tm_mday) |
Calculate day of week. More... | |
time_t | mktime (struct tm *tm) |
Calculate seconds since the Epoch. More... | |
Variables | |
signed long | time_offset |
Current system clock offset. More... | |
static const char * | weekdays [] |
Days of week (for debugging) More... | |
static const uint16_t | days_to_month_start [] |
Days from start of year until start of months (in non-leap years) More... | |
Date and time.
POSIX:2008 section 4.15 defines "seconds since the Epoch" as an abstract measure approximating the number of seconds that have elapsed since the Epoch, excluding leap seconds. The formula given is
tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 + (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 - ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400
This calculation assumes that leap years occur in each year that is either divisible by 4 but not divisible by 100, or is divisible by 400.
Definition in file time.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
|
static |
Calculate number of leap years since 1900.
tm_year | Years since 1900 |
num_leap_years | Number of leap years |
Definition at line 79 of file time.c.
Referenced by day_of_week(), and mktime().
|
static |
Calculate day of week.
tm_year | Years since 1900 |
tm_mon | Month of year [0,11] |
tm_day | Day of month [1,31] |
Definition at line 96 of file time.c.
References leap_years_to_end(), and offset.
Referenced by mktime().
Calculate seconds since the Epoch.
tm | Broken-down time |
time | Seconds since the Epoch |
Definition at line 117 of file time.c.
References day_of_week(), days_to_month_start, DBGC, is_leap_year(), leap_years_to_end(), seconds, tm::tm_hour, tm::tm_mday, tm::tm_min, tm::tm_mon, tm::tm_sec, tm::tm_wday, tm::tm_yday, tm::tm_year, and weekdays.
Referenced by asn1_generalized_time(), efi_get_time(), and rtc_read_time().
signed long time_offset |
|
static |