aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/rtc.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2008-02-09 10:16:58 -0500
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:40:45 -0400
commitb62576a2f53ad7edf604fedba0da1d4329749b7d (patch)
tree9a4a0fd20ef48b10d61d3dfd212649a601cd6a26 /arch/x86/kernel/rtc.c
parent48c508b364324c35018284328b5b92c51d2b30e0 (diff)
x86: use year 2000 offset for cmos clock
We know it is already after 2000. Use the year 2000 offset for both 32 and 64 bit, which removes ifdefs and the 1970 magic. [ tglx@linutronix.de: remove 1970 magic, replace bogus commit message ] Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/rtc.c')
-rw-r--r--arch/x86/kernel/rtc.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index eb9b1a198f5e..d2569513ad4c 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -9,7 +9,6 @@
9#include <asm/vsyscall.h> 9#include <asm/vsyscall.h>
10 10
11#ifdef CONFIG_X86_32 11#ifdef CONFIG_X86_32
12# define CMOS_YEARS_OFFS 1900
13/* 12/*
14 * This is a special lock that is owned by the CPU and holds the index 13 * This is a special lock that is owned by the CPU and holds the index
15 * register we are working with. It is required for NMI access to the 14 * register we are working with. It is required for NMI access to the
@@ -17,14 +16,11 @@
17 */ 16 */
18volatile unsigned long cmos_lock = 0; 17volatile unsigned long cmos_lock = 0;
19EXPORT_SYMBOL(cmos_lock); 18EXPORT_SYMBOL(cmos_lock);
20#else
21/*
22 * x86-64 systems only exists since 2002.
23 * This will work up to Dec 31, 2100
24 */
25# define CMOS_YEARS_OFFS 2000
26#endif 19#endif
27 20
21/* For two digit years assume time is always after that */
22#define CMOS_YEARS_OFFS 2000
23
28DEFINE_SPINLOCK(rtc_lock); 24DEFINE_SPINLOCK(rtc_lock);
29EXPORT_SYMBOL(rtc_lock); 25EXPORT_SYMBOL(rtc_lock);
30 26
@@ -136,11 +132,8 @@ unsigned long mach_get_cmos_time(void)
136 BCD_TO_BIN(century); 132 BCD_TO_BIN(century);
137 year += century * 100; 133 year += century * 100;
138 printk(KERN_INFO "Extended CMOS year: %d\n", century * 100); 134 printk(KERN_INFO "Extended CMOS year: %d\n", century * 100);
139 } else { 135 } else
140 year += CMOS_YEARS_OFFS; 136 year += CMOS_YEARS_OFFS;
141 if (year < 1970)
142 year += 100;
143 }
144 137
145 return mktime(year, mon, day, hour, min, sec); 138 return mktime(year, mon, day, hour, min, sec);
146} 139}