Hello,

Reading /arch/amd64/isa/clock.c, I notice we have the following code,
which is also in the i386 version:

                /* Kludge to roll over century. */
                if ((rtc_update_century > 0) ||
                    ((cmoscentury == 19) && (clockcentury == 20) &&
                     (clockyear == 2000))) {
                        printf("WARNING: Setting NVRAM century to %d\n",
                               clockcentury);
                        s = splclock();
                        mc146818_write(NULL, centb, bintobcd(clockcentury));
                        splx(s);
                }

This is obviously to fix the 'first boot after 2000' problem where buggy
bioses would report 1900.  However, the code assumes that the first boot
of such a system will actually be during the year 2000 for the fix to
work.

Given that we are now in 2013, the issue is only going to surface
if the BIOS battery fails and sets the clock back to 1996 or something
like that, (unlikely on amd64, I know, but possible on an old 486 for
example), and the correct time is then picked up from the filesystem
timestamp and used to reset the RTC, due to the filesystem time being far
in the future.

In that case, however, the NVRAM setting will remain incorrect, and this
code is isn't even going to execute, because we're checking for
clockyear == 2000 rather than clockyear >= 2000.

Would the solution be to write both century and year to the NVRAM if
(cmoscentury == 19) && (clockcentury == 20) ? 
-- 
Creamy

Reply via email to