NorthernWidget / DS3231

Communicates between Arduino-programmed AVR and Maxim DS3231 RTC: splice of Ayars' (http://hacks.ayars.org/2011/04/ds3231-real-time-clock.html) and Jeelabs/Ladyada's (https://github.com/adafruit/RTClib) libraries
The Unlicense
186 stars 81 forks source link

Fix datetime parsing #49

Closed vlad0x00 closed 2 years ago

vlad0x00 commented 2 years ago

Parsing __DATE__ and __TIME__ does not work right now, this PR fixes it.

Current parsing tries to parse double digits as a character which only takes the first digit. It used to work before this commit: https://github.com/NorthernWidget/DS3231/commit/c15b45025691f90caceb793480b62132886742eb But the scanf string wasn't correct before either, as it used %d for uint8_t, while %d should be used for int. The correct specifier for uint8_t would be %hhu as per https://www.cplusplus.com/reference/cstdio/scanf/

awickert commented 2 years ago

Many thanks for this improvement to the parser!