ropg / ezTime

ezTime — pronounced "Easy Time" — is a very easy to use Arduino time and date library that provides NTP network time lookups, extensive timezone support, formatted time and date strings, user events, millisecond precision and more.
MIT License
327 stars 92 forks source link

timeStatus timeNeedsSync never seted #23

Closed dicson closed 5 years ago

dicson commented 5 years ago

Thanks for you work! I think timeNeedsSync status never can be set. I did not find in the code timeNeedsSync and if I disable connection I always see status '2' (timeSet). Maybe I'm wrong. Sorry for my bad english

ropg commented 5 years ago

Sorry for the late reply. Will leave this open and investigate soon as I get some time to work on it.

mike-s123 commented 5 years ago

I think you want something like this at the end of updateNTP():

      if (queryNTP(_ntp_server, t, measured_at)) {
...
      } else {
        if ( nowUTC(false) > _last_sync_time + _ntp_interval + NTP_STALE_AFTER ) {
          _time_status = timeNeedsSync;
        }  
        UTC.setEvent(updateNTP, nowUTC(false) + NTP_RETRY);
      }
ropg commented 5 years ago

Fixed by commit 16539554d790465eececab97040cf6262331b8b8 from #29 (thanks!)

dicson commented 5 years ago

Thank you very much!