jarzebski / Arduino-DS3231

DS3231 Real-Time-Clock
MIT License
157 stars 84 forks source link

setDateTime with epoc unixtime unexpected behavior #18

Open erikyo opened 6 years ago

erikyo commented 6 years ago

First of all I want to congratulate this library really well done, but I found for a small problem that I had to correct to make my sketch work properly.

If you "setDateTime()" with an Epoc Unix Timestamp the time you set in the watch is one hour earlier than I wanted. I think the problem is due to the fact that 946681200 (master/DS3231.cpp line 90) corresponds to "GMT: Friday, December 31, 1999 11:00 pm PM" and not to the 0 of 1 January.

It would also be interesting to implement the timezone since unix epoc is always UTC.

Thanks, Erik

kurt-klingbeil commented 1 year ago

also, I see no way to get unixtime