Revision: 605
http://svn.sourceforge.net/hackndev/?rev=605&view=rev
Author: bobofdoom
Date: 2006-09-30 19:30:34 -0700 (Sat, 30 Sep 2006)
Log Message:
-----------
all: time: Added CONFIG_PXA_RTC_EPOCH so that we can set hardware epoch to 1904 to coexist peacefully with POS.
Modified Paths:
--------------
linux4palm/linux/trunk/drivers/rtc/rtc-sa1100.c
Modified: linux4palm/linux/trunk/drivers/rtc/rtc-sa1100.c
===================================================================
--- linux4palm/linux/trunk/drivers/rtc/rtc-sa1100.c 2006-10-01 02:30:08 UTC (rev 604)
+++ linux4palm/linux/trunk/drivers/rtc/rtc-sa1100.c 2006-10-01 02:30:34 UTC (rev 605)
@@ -73,6 +73,12 @@
#define RTC_AF 0x20
#define RTC_UF 0x10
+#ifdef CONFIG_PXA_RTC_EPOCH
+#define EPOCH_YEAR CONFIG_PXA_RTC_EPOCH
+#else
+#define EPOCH_YEAR 1970
+#endif
+
static unsigned long rtc_status;
static unsigned long rtc_irq_data;
static unsigned long rtc_freq = 1024;
@@ -103,10 +109,10 @@
#define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400)
- year = 1970 + days / 365;
- days -= ((year - 1970) * 365
+ year = EPOCH_YEAR + days / 365;
+ days -= ((year - EPOCH_YEAR) * 365
+ LEAPS_THRU_END_OF (year - 1)
- - LEAPS_THRU_END_OF (1970 - 1));
+ - LEAPS_THRU_END_OF (EPOCH_YEAR - 1));
if (days < 0) {
year -= 1;
days += 365 + is_leap(year);
@@ -344,7 +350,7 @@
if (copy_from_user (&tm, (struct rtc_time*)arg, sizeof (tm)))
return -EFAULT;
tm.tm_year += 1900;
- if (tm.tm_year < 1970 || (unsigned)tm.tm_mon >= 12 ||
+ if (tm.tm_year < EPOCH_YEAR || (unsigned)tm.tm_mon >= 12 ||
tm.tm_mday < 1 || tm.tm_mday > (days_in_mo[tm.tm_mon] +
(tm.tm_mon == 1 && is_leap(tm.tm_year))) ||
(unsigned)tm.tm_hour >= 24 ||
@@ -364,7 +370,7 @@
rtc_freq = arg;
return 0;
case RTC_EPOCH_READ:
- return put_user (1970, (unsigned long *)arg);
+ return put_user (EPOCH_YEAR, (unsigned long *)arg);
default:
return -EINVAL;
}
@@ -399,7 +405,7 @@
"rtc_date\t: %04d-%02d-%02d\n"
"rtc_epoch\t: %04d\n",
tm.tm_hour, tm.tm_min, tm.tm_sec,
- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 1970);
+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, EPOCH_YEAR);
decodetime (RTAR, &tm);
p += sprintf(p, "alrm_time\t: %02d:%02d:%02d\n"
"alrm_date\t: %04d-%02d-%02d\n",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|