tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

probable slight bug in ds1307 RTC driver for year 2100



Hi,

in order to avoid breaking working setups using a dsrtc at iic, I
introduced a flag DSRTC_FLAG_YEAR_START_2K to impose a base year of 2000
on a per-chip basis. The existing code starts at POSIX_BASE_YEAR (1970),
with the comment:

/* XXX: Should be an MD way to specify EPOCH used by BIOS/Firmware */

However, in order to keep track of the date on chips which use the
day/month/year format (not all of them), the year needs to be consistent
with what the chip believes, if leap years are to be accounted for
correctly.

I'm afraid in 2100, these chips which we offset by 30 years in the code
will believe the year is a leap year (2070) when it's actually not (2100),
and the reciprocal problem will arise in 2130.

If someone feels confident enough with all the variations of the chip to
straighten this out, that would be nice. The safest way is probably to
add individually the DSRTC_FLAG_YEAR_START_2K to chips known indeed to
start their counting at year 2000 (might be all of them). Of course all
users have to update the date after the change, which is not nice.

See sys/dev/i2c/ds1307.c around line 477.

Sorry for the long e-mail for a small problem, :-)
 Aymeric


Home | Main Index | Thread Index | Old Index