diff -urN 2.2.17pre20/arch/alpha/kernel/time.c z/arch/alpha/kernel/time.c --- 2.2.17pre20/arch/alpha/kernel/time.c Tue Jun 13 03:48:12 2000 +++ z/arch/alpha/kernel/time.c Fri Sep 1 03:06:23 2000 @@ -21,6 +21,9 @@ * 1999-04-16 Thorsten Kranzkowski (dl8bcu@gmx.net) * fixed algorithm in do_gettimeofday() for calculating the precise time * from processor cycle counter (now taking lost_ticks into account) + * 2000-08-13 Jan-Benedict Glaw + * Fixed time_init to be aware of epoches != 1900. This prevents + * booting up in 2048 for me;) Code is stolen from rtc.c. */ #include #include @@ -235,7 +238,7 @@ time_init(void) { void (*irq_handler)(int, void *, struct pt_regs *); - unsigned int year, mon, day, hour, min, sec, cc1, cc2; + unsigned int year, mon, day, hour, min, sec, cc1, cc2, epoch; unsigned long cycle_freq, ppm_error; long diff; @@ -310,16 +313,24 @@ BCD_TO_BIN(mon); BCD_TO_BIN(year); } -#ifdef ALPHA_PRE_V1_2_SRM_CONSOLE - /* - * The meaning of life, the universe, and everything. Plus - * this makes the year come out right on SRM consoles earlier - * than v1.2. - */ - year -= 42; -#endif - if ((year += 1900) < 1970) + + /* PC-like is standard; used for year <= 20 || year >= 100 */ + epoch = 1900; + if (year > 20 && year < 48) + /* ARC console, used on some not so old boards */ + epoch = 1980; + else if (year >= 48 && year < 70) + /* Digital UNIX, used on older boards (eg. AXPpxi33) */ + epoch = 1952; + else if (year >= 70 && year < 100) + /* Digital DECstations, very old... */ + epoch = 1928; + + printk(KERN_INFO "Using epoch = %d\n", epoch); + + if ((year += epoch) < 1970) year += 100; + xtime.tv_sec = mktime(year, mon, day, hour, min, sec); xtime.tv_usec = 0;