patch-2.1.35 linux/drivers/char/rtc.c

Next file: linux/fs/inode.c
Previous file: linux/arch/i386/vmlinux.lds
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.34/linux/drivers/char/rtc.c linux/drivers/char/rtc.c
@@ -56,6 +56,13 @@
 #include <asm/system.h>
 #include <asm/poll.h>
 
+/* Adjust starting epoch if ARC console time is being used */
+#ifdef CONFIG_RTC_ARC
+#define ARCFUDGE 20 
+#else
+#define ARCFUDGE 0
+#endif
+
 /*
  *	We sponge a minor off of the misc major. No need slurping
  *	up another valuable major dev number for this. If you add
@@ -336,7 +343,7 @@
 
 			copy_from_user(&rtc_tm, (struct rtc_time*)arg, sizeof(struct rtc_time));
 
-			yrs = rtc_tm.tm_year + 1900;
+			yrs = rtc_tm.tm_year + 1900 + ARCFUDGE;
 			mon = rtc_tm.tm_mon + 1;   /* tm_mon starts at zero */
 			day = rtc_tm.tm_mday;
 			hrs = rtc_tm.tm_hour;
@@ -724,6 +731,9 @@
 	 */
 	if (rtc_tm->tm_year <= 69)
 		rtc_tm->tm_year += 100;
+
+	/* if ARCFUDGE == 0, the optimizer should do away with this */
+	rtc_tm->tm_year -= ARCFUDGE;
 
 	rtc_tm->tm_mon--;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov