15 #include <linux/rtc.h>
19 #define SECS_PER_HOUR (60 * 60)
20 #define SECS_PER_DAY (SECS_PER_HOUR * 24)
27 #define RTC_BATT_BAD 0x100
31 #define RTC_DM_BINARY 0x04
33 #define RTC_DST_EN 0x01
35 # define __isleap(year) \
36 ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
39 static const unsigned short int __mon_yday[2][13] =
42 { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
44 { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
50 long int days, rem,
y;
51 const unsigned short int *
ip;
53 memset(wtime, 0,
sizeof(*wtime));
73 #define DIV(a, b) ((a) / (b) - ((a) % (b) < 0))
74 #define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400))
76 while (days < 0 || days >= (__isleap (y) ? 366 : 365))
79 long int yg = y + days / 365 - (days % 365 < 0);
82 days -= ((yg -
y) * 365
83 + LEAPS_THRU_END_OF (yg - 1)
90 for (y = 11; days < (
long int) ip[y]; --
y)
113 static inline unsigned int get_rtc_ss(
void)