leomil72 / swRTC

swRTC is a library that implements a software-RTC on an Arduino board or an Atmel microcontroller
35 stars 16 forks source link

EPOCh incompatibility with avr-libc #9

Open richdrich opened 5 years ago

richdrich commented 5 years ago

This isn't your bug, but it's something that might be good to note in the docs.

avr-libc uses a non standard time epoch starting Midnight, Jan 1 2000 UTC, not 1-1-1970 as for unix and swrtc.

So if you take a time from this library and give it to e.g. gmtime it will be 30 years out. The fix is to add or subtract UNIX_OFFSET.

Just a thought really for anyone else who might be confused by this.