11 #define STARTOFTIME 1970
13 #define SECYR (SECDAY * 365)
14 #define LEAP_YEAR(year) (((year) % 4 == 0 && (year) % 100 != 0) || (year) % 400 == 0)
15 #define DAYS_IN_YEAR(a) (LEAP_YEAR(a) ? 366 : 365)
16 #define DAYS_IN_MONTH(a) (month_days[(a) - 1])
19 "Sun",
"Mon",
"Tues",
"Wednes",
"Thurs",
"Fri",
"Satur"
27 const int zyear = ((tm->
mon < 3) ? tm->
year - 1 : tm->
year);
28 const int q = tm->
mday;
29 const int m = (tm->
mon < 3) ? tm->
mon + 12 : tm->
mon;
30 const int K = zyear % 100;
31 const int J = zyear / 100;
39 const int h = (q + (13 * (
m + 1)) / 5
40 + K + (K / 4) + (J / 4) + (5 * J) - 1) % 7;
48 int month_days[12] = {
49 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
52 register long hms, day;
58 tm->
hour = hms / 3600;
59 tm->
min = (hms % 3600) / 60;
60 tm->
sec = (hms % 3600) % 60;
110 days = (
unsigned long)(
year / 4 -
year / 100 +
year / 400 +
111 367 * mon / 12 + tm->
mday) +
113 hours = days * 24 + tm->
hour;
114 return (hours * 60 + tm->
min) * 60 + tm->
sec;
127 int month_days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
134 if (tm->
sec > 59 || tm->
min > 59 || tm->
hour > 23 || tm->
mon == 0 || tm->
mon > 12 ||
#define printk(level,...)
unsigned long rtc_mktime(const struct rtc_time *tm)
int rtc_invalid(const struct rtc_time *tm)
static const char *const weekdays[]
static int rtc_calc_weekday(struct rtc_time *tm)
static int rtc_month_days(unsigned int month, unsigned int year)
void rtc_display(const struct rtc_time *tm)
int rtc_to_tm(int tim, struct rtc_time *tm)
#define BIOS_INFO
BIOS_INFO - Expected events.
#define m(clkreg, src_bits, pmcreg, dst_bits)