sleemanj / DS3231_Simple

An Arduino Library for EASY communication with DS3231 I2C RTC Clock and Atmel AT24C32 I2C EEPROM commonly found on the same board. Implements setting, getting the time/date, setting, checking and clearing alarms, and dead-easy circular-buffered logging of data with timestamp.
MIT License
82 stars 25 forks source link

add getUnixTime function #16

Open howard-wong opened 5 years ago

sleemanj commented 5 years ago

Thank you for the PR.

Leap year calculation appears incomplete, for example 2100 will not be a leap year but your code would include it I think.

"dim" and "a_dim" are not very descriptive names

I'm not sure about dim[i] unless this is a new feature of GCC handling it automatically, since a_dim is in PROGMEM the program memory reading functions (pgm_read_byte specifically) need to be used, without retrieving the data in this manner you are just grabbing random junk from a ram location, not the flash location.