diff options
author | phk <phk@FreeBSD.org> | 2002-12-04 13:46:49 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-12-04 13:46:49 +0000 |
commit | 7beb8a484e9e81dd0521f9480bd23f0cc33386f4 (patch) | |
tree | de81061901875a5c3e904ff3c96b0ae30fefdbd8 /sys | |
parent | fdd44c57ca843e292df42853dc891a43b435fa1d (diff) | |
download | FreeBSD-src-7beb8a484e9e81dd0521f9480bd23f0cc33386f4.zip FreeBSD-src-7beb8a484e9e81dd0521f9480bd23f0cc33386f4.tar.gz |
Use the correct value when writing the Day Of Week byte in the CMOS.
The correct range is [1...7] with Sunday=1, but we have been writing
[0...6] with Sunday=0.
The Soekris computers flagged the zero, zapped the date, so if you
rebooted your soekris on a sunday, it would come up with a wrong
date.
Bruce has a more extensive rework of this code, but we will stick with
the minimalist fix for now.
Spotted by: Soren Kristensen <soren@soekris.com>
Thanks to: Michael Sierchio <kudzu@tenebras.com>.
Confirmed by: bde
Approved by: re
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/tsc.c | 2 | ||||
-rw-r--r-- | sys/amd64/isa/clock.c | 2 | ||||
-rw-r--r-- | sys/i386/i386/tsc.c | 2 | ||||
-rw-r--r-- | sys/i386/isa/clock.c | 2 | ||||
-rw-r--r-- | sys/isa/atrtc.c | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c index 93d486c..140f6bc 100644 --- a/sys/amd64/amd64/tsc.c +++ b/sys/amd64/amd64/tsc.c @@ -943,7 +943,7 @@ resettodr() writertc(RTC_HRS, bin2bcd(tm%24)); tm /= 24; /* Write back Hours */ /* We have now the days since 01-01-1970 in tm */ - writertc(RTC_WDAY, (tm+4)%7); /* Write back Weekday */ + writertc(RTC_WDAY, (tm + 4) % 7 + 1); /* Write back Weekday */ for (y = 1970, m = DAYSPERYEAR + LEAPYEAR(y); tm >= m; y++, m = DAYSPERYEAR + LEAPYEAR(y)) diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index 93d486c..140f6bc 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -943,7 +943,7 @@ resettodr() writertc(RTC_HRS, bin2bcd(tm%24)); tm /= 24; /* Write back Hours */ /* We have now the days since 01-01-1970 in tm */ - writertc(RTC_WDAY, (tm+4)%7); /* Write back Weekday */ + writertc(RTC_WDAY, (tm + 4) % 7 + 1); /* Write back Weekday */ for (y = 1970, m = DAYSPERYEAR + LEAPYEAR(y); tm >= m; y++, m = DAYSPERYEAR + LEAPYEAR(y)) diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c index 93d486c..140f6bc 100644 --- a/sys/i386/i386/tsc.c +++ b/sys/i386/i386/tsc.c @@ -943,7 +943,7 @@ resettodr() writertc(RTC_HRS, bin2bcd(tm%24)); tm /= 24; /* Write back Hours */ /* We have now the days since 01-01-1970 in tm */ - writertc(RTC_WDAY, (tm+4)%7); /* Write back Weekday */ + writertc(RTC_WDAY, (tm + 4) % 7 + 1); /* Write back Weekday */ for (y = 1970, m = DAYSPERYEAR + LEAPYEAR(y); tm >= m; y++, m = DAYSPERYEAR + LEAPYEAR(y)) diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 93d486c..140f6bc 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -943,7 +943,7 @@ resettodr() writertc(RTC_HRS, bin2bcd(tm%24)); tm /= 24; /* Write back Hours */ /* We have now the days since 01-01-1970 in tm */ - writertc(RTC_WDAY, (tm+4)%7); /* Write back Weekday */ + writertc(RTC_WDAY, (tm + 4) % 7 + 1); /* Write back Weekday */ for (y = 1970, m = DAYSPERYEAR + LEAPYEAR(y); tm >= m; y++, m = DAYSPERYEAR + LEAPYEAR(y)) diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index 93d486c..140f6bc 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -943,7 +943,7 @@ resettodr() writertc(RTC_HRS, bin2bcd(tm%24)); tm /= 24; /* Write back Hours */ /* We have now the days since 01-01-1970 in tm */ - writertc(RTC_WDAY, (tm+4)%7); /* Write back Weekday */ + writertc(RTC_WDAY, (tm + 4) % 7 + 1); /* Write back Weekday */ for (y = 1970, m = DAYSPERYEAR + LEAPYEAR(y); tm >= m; y++, m = DAYSPERYEAR + LEAPYEAR(y)) |