tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
608 stars 192 forks source link

ds3231: Document incorrect leap year 2100 #530

Closed bxparks closed 1 year ago

bxparks commented 1 year ago

The current code interprets the 'century' flag as the year 2100. However the DS3231 hardware does not incorporate this flag in its leap year calculation, so will incorrectly consider the year 2100 as a leap year and increment from 2100-02-28 to 2100-02-29 instead of the correct 2100-03-01.

The 'century' bit is not useful for anything as far as I can tell. But instead of removing the code that uses the 'century' bit, I thought it would be less intrusive to just document the current behavior.

deadprogram commented 1 year ago

Fantastic job documenting this @bxparks thanks! Now merging.