8 #ifndef __ASM_MC146818_TIME_H
9 #define __ASM_MC146818_TIME_H
13 #include <linux/time.h>
18 #define USEC_AFTER 500000
19 #define USEC_BEFORE 500000
31 static inline int mc146818_set_rtc_mmss(
unsigned long nowtime)
33 int real_seconds, real_minutes, cmos_minutes;
34 unsigned char save_control, save_freq_select;
47 cmos_minutes =
bcd2bin(cmos_minutes);
55 real_seconds = nowtime % 60;
56 real_minutes = nowtime / 60;
57 if (((
abs(real_minutes - cmos_minutes) + 15)/30) & 1)
61 if (
abs(real_minutes - cmos_minutes) < 30) {
63 real_seconds =
bin2bcd(real_seconds);
64 real_minutes =
bin2bcd(real_minutes);
70 "set_rtc_mmss: can't update from %d to %d\n",
71 cmos_minutes, real_minutes);
84 spin_unlock_irqrestore(&
rtc_lock, flags);
89 static inline unsigned long mc146818_get_cmos_time(
void)
113 spin_unlock_irqrestore(&rtc_lock, flags);
116 return mktime(year, mon, day, hour, min, sec);