From: <bob...@us...> - 2006-10-01 02:30:17
|
Revision: 604 http://svn.sourceforge.net/hackndev/?rev=604&view=rev Author: bobofdoom Date: 2006-09-30 19:30:08 -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/arch/arm/mach-pxa/Kconfig linux4palm/linux/trunk/arch/arm/mach-pxa/time.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/Kconfig =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/Kconfig 2006-09-30 08:21:19 UTC (rev 603) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/Kconfig 2006-10-01 02:30:08 UTC (rev 604) @@ -164,4 +164,11 @@ to work around certain bootloaders overwriting them during resume. +config PXA_RTC_EPOCH + int "PXA RTC epoch year" + default "1970" + help + The default Linux epoch Jan 1st 1970, however to + operate alongside PalmOS nicely, change this to 1904. + endif Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/time.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/time.c 2006-09-30 08:21:19 UTC (rev 603) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/time.c 2006-10-01 02:30:08 UTC (rev 604) @@ -29,16 +29,19 @@ #include <asm/mach/time.h> #include <asm/arch/pxa-regs.h> +#define ONE_YEAR 31557600 /* seconds */ static inline unsigned long pxa_get_rtc_time(void) { - return RCNR; + return RCNR - (1970-CONFIG_PXA_RTC_EPOCH)*ONE_YEAR; } static int pxa_set_rtc(void) { unsigned long current_time = xtime.tv_sec; + current_time += (1970-CONFIG_PXA_RTC_EPOCH)*ONE_YEAR; + if (RTSR & RTSR_ALE) { /* make sure not to forward the clock over an alarm */ unsigned long alarm = RTAR; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |