jarzebski / Arduino-DS3231

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

Incorect work whis unixtime #7

Closed ASergeyV closed 1 year ago

ASergeyV commented 8 years ago

Using TimeLib.h and DS3231.h. Arduino code:

dt = DS3231clock.getDateTime();
s += "<br>Local Time: " + printDigits(day()) + "-" + printDigits(month()) + "-" + String(year()) + " " + printDigits(hour()) + ":" + printDigits(minute()) + ":" + printDigits(second());
s += "<br>Local Unix Time: " + String(now());
s += "<br>DS3231 Time: " + String(DS3231clock.dateFormat("d-m-Y H:i:s", dt));
s += "<br>DS3231 Unix Time: " + String(DS3231clock.dateFormat("U", dt));

result: Local Time: 16-06-2016 13:37:53 Local Unix Time: 1466084273 DS3231 Time: 16-06-2016 13:37:53 DS3231 Unix Time: 1465994273

Why the difference in 90000 seconds? Also, do not put the correct unixtime in setDateTime function