Skip to contentSkip to conversation

PPC: set default date on PPC without RTC

PATCH Wladislav Wiebe 1 participant 2 messages Sep 11, 2013

lore
Share & tools
lore
#0 lore raw

Hello guys,

would like to ask if there is a proper possibility on PPC to set default date (basically the year). The board has no RTC chip, and I would need instead of 1970 another year.

For some reason does e.g:

linux/arch/powerpc/kernel/time.c +1 -1
@@ -1099,7 +1099,7 @@ void __init time_init(void)
 
 
 #define FEBRUARY       2
-#define        STARTOFTIME     1970
+#define        STARTOFTIME     2013
 #define SECDAY         86400L
 #define SECYR          (SECDAY * 365)
 #define        leapyear(year)          ((year) % 4 == 0 && \

not work to me. Is there also another place which should be changed? (I know it can be changed from userspace also, but I would need it before userspace)

Thanks and BR,
Wladislav Wiebe

#1 lore raw

Hi,

no matter anymore - got it:

linux/arch/powerpc/kernel/time.c +1 -1
@@ -832,7 +832,7 @@ static void __read_persistent_clock(struct timespec *ts)
 		}
 	}
 	if (!ppc_md.get_rtc_time) {
-		ts->tv_sec = 0;
+		ts->tv_sec = mktime(2011, 1, 1, 0, 0, 0);
 		return;
 	}
 	ppc_md.get_rtc_time(&tm);
Quoted 27 lines · Wladislav Wiebe

Hello guys,

would like to ask if there is a proper possibility on PPC to set default date (basically the year). The board has no RTC chip, and I would need instead of 1970 another year.

For some reason does e.g:

linux/arch/powerpc/kernel/time.c +1 -1
@@ -1099,7 +1099,7 @@ void __init time_init(void)
 
 
 #define FEBRUARY       2
-#define        STARTOFTIME     1970
+#define        STARTOFTIME     2013
 #define SECDAY         86400L
 #define SECYR          (SECDAY * 365)
 #define        leapyear(year)          ((year) % 4 == 0 && \

not work to me. Is there also another place which should be changed? (I know it can be changed from userspace also, but I would need it before userspace)

Thanks and BR,
Wladislav Wiebe