From: <bob...@us...> - 2006-10-31 02:29:30
|
Revision: 653 http://svn.sourceforge.net/hackndev/?rev=653&view=rev Author: bobofdoom Date: 2006-10-30 18:29:20 -0800 (Mon, 30 Oct 2006) Log Message: ----------- l4p: Fixed 12-hour out clock bug. Committed for step2back. Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/time.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/time.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/time.c 2006-10-30 22:39:11 UTC (rev 652) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/time.c 2006-10-31 02:29:20 UTC (rev 653) @@ -29,18 +29,24 @@ #include <asm/mach/time.h> #include <asm/arch/pxa-regs.h> -#define ONE_YEAR 31557600 /* seconds */ +#define PL_ODDS (1970-CONFIG_PXA_RTC_EPOCH) +#define SECS_PER_DAY 24*60*60 +#define SECS_PER_LEAP (SECS_PER_DAY*366) +#define SECS_PER_OTHER (SECS_PER_DAY*365) +#define SECS_LY (((PL_ODDS-(PL_ODDS % 4))/4)*SECS_PER_LEAP) +#define SECS_OY ((PL_ODDS-((PL_ODDS-(PL_ODDS % 4))/4))*SECS_PER_OTHER) +#define SECS_ODDS_SUM (SECS_LY+SECS_OY) static inline unsigned long pxa_get_rtc_time(void) { - return RCNR - (1970-CONFIG_PXA_RTC_EPOCH)*ONE_YEAR; + return RCNR - SECS_ODDS_SUM; } static int pxa_set_rtc(void) { unsigned long current_time = xtime.tv_sec; - current_time += (1970-CONFIG_PXA_RTC_EPOCH)*ONE_YEAR; + current_time += SECS_ODDS_SUM; if (RTSR & RTSR_ALE) { /* make sure not to forward the clock over an alarm */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |