aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ppc/platforms/chrp_time.c22
-rw-r--r--arch/sh/boards/mpc1211/rtc.c23
-rw-r--r--include/asm-i386/mach-default/mach_time.h21
3 files changed, 36 insertions, 30 deletions
diff --git a/arch/ppc/platforms/chrp_time.c b/arch/ppc/platforms/chrp_time.c
index e103a36e11a5..51e06ad66168 100644
--- a/arch/ppc/platforms/chrp_time.c
+++ b/arch/ppc/platforms/chrp_time.c
@@ -129,16 +129,18 @@ unsigned long chrp_get_rtc_time(void)
129 year = chrp_cmos_clock_read(RTC_YEAR); 129 year = chrp_cmos_clock_read(RTC_YEAR);
130 } while (sec != chrp_cmos_clock_read(RTC_SECONDS)); 130 } while (sec != chrp_cmos_clock_read(RTC_SECONDS));
131 131
132 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 132 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY)
133 { 133 || RTC_ALWAYS_BCD) {
134 BCD_TO_BIN(sec); 134 BCD_TO_BIN(sec);
135 BCD_TO_BIN(min); 135 BCD_TO_BIN(min);
136 BCD_TO_BIN(hour); 136 BCD_TO_BIN(hour);
137 BCD_TO_BIN(day); 137 BCD_TO_BIN(day);
138 BCD_TO_BIN(mon); 138 BCD_TO_BIN(mon);
139 BCD_TO_BIN(year); 139 BCD_TO_BIN(year);
140 } 140 }
141 if ((year += 1900) < 1970) 141
142 year += 1900;
143 if (year < 1970)
142 year += 100; 144 year += 100;
143 return mktime(year, mon, day, hour, min, sec); 145 return mktime(year, mon, day, hour, min, sec);
144} 146}
diff --git a/arch/sh/boards/mpc1211/rtc.c b/arch/sh/boards/mpc1211/rtc.c
index 76aab46e59a0..8ae2dc11d8e5 100644
--- a/arch/sh/boards/mpc1211/rtc.c
+++ b/arch/sh/boards/mpc1211/rtc.c
@@ -34,18 +34,21 @@ unsigned long get_cmos_time(void)
34 year = CMOS_READ(RTC_YEAR); 34 year = CMOS_READ(RTC_YEAR);
35 } while (sec != CMOS_READ(RTC_SECONDS)); 35 } while (sec != CMOS_READ(RTC_SECONDS));
36 36
37 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 37 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
38 { 38 BCD_TO_BIN(sec);
39 BCD_TO_BIN(sec); 39 BCD_TO_BIN(min);
40 BCD_TO_BIN(min); 40 BCD_TO_BIN(hour);
41 BCD_TO_BIN(hour); 41 BCD_TO_BIN(day);
42 BCD_TO_BIN(day); 42 BCD_TO_BIN(mon);
43 BCD_TO_BIN(mon); 43 BCD_TO_BIN(year);
44 BCD_TO_BIN(year); 44 }
45 } 45
46 spin_unlock(&rtc_lock); 46 spin_unlock(&rtc_lock);
47 if ((year += 1900) < 1970) 47
48 year += 1900;
49 if (year < 1970)
48 year += 100; 50 year += 100;
51
49 return mktime(year, mon, day, hour, min, sec); 52 return mktime(year, mon, day, hour, min, sec);
50} 53}
51 54
diff --git a/include/asm-i386/mach-default/mach_time.h b/include/asm-i386/mach-default/mach_time.h
index ff03cf0fdc3c..31eb5de6f3dc 100644
--- a/include/asm-i386/mach-default/mach_time.h
+++ b/include/asm-i386/mach-default/mach_time.h
@@ -92,16 +92,17 @@ static inline unsigned long mach_get_cmos_time(void)
92 year = CMOS_READ(RTC_YEAR); 92 year = CMOS_READ(RTC_YEAR);
93 } while (sec != CMOS_READ(RTC_SECONDS)); 93 } while (sec != CMOS_READ(RTC_SECONDS));
94 94
95 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 95 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
96 { 96 BCD_TO_BIN(sec);
97 BCD_TO_BIN(sec); 97 BCD_TO_BIN(min);
98 BCD_TO_BIN(min); 98 BCD_TO_BIN(hour);
99 BCD_TO_BIN(hour); 99 BCD_TO_BIN(day);
100 BCD_TO_BIN(day); 100 BCD_TO_BIN(mon);
101 BCD_TO_BIN(mon); 101 BCD_TO_BIN(year);
102 BCD_TO_BIN(year); 102 }
103 } 103
104 if ((year += 1900) < 1970) 104 year += 1900;
105 if (year < 1970)
105 year += 100; 106 year += 100;
106 107
107 return mktime(year, mon, day, hour, min, sec); 108 return mktime(year, mon, day, hour, min, sec);