You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DS3231 uses a century bit in bit 7 of the month register(x05).
If this bit is set, as could happen if the clock was set by another library, the bcd2dec() in getDateTime will get the month wrong. example, May which is 05 will be read as 85.
As this lib always assumes years > 2k it never sets the century bit, this is only an issue if the clock chip has been set elsewhere and the century bit was used.
A possible solution is to change getDateTime() to something like the following. (other changes to handle the century bit will also be needed)
RTCDateTime DS3231::getDateTime(void)
{
int values[7];
int century = 0;
int n;
The DS3231 uses a century bit in bit 7 of the month register(x05).
If this bit is set, as could happen if the clock was set by another library, the bcd2dec() in getDateTime will get the month wrong. example, May which is 05 will be read as 85.
As this lib always assumes years > 2k it never sets the century bit, this is only an issue if the clock chip has been set elsewhere and the century bit was used.
A possible solution is to change getDateTime() to something like the following. (other changes to handle the century bit will also be needed)
RTCDateTime DS3231::getDateTime(void)
{
int values[7];
int century = 0;
int n;
}
The text was updated successfully, but these errors were encountered: