-
Notifications
You must be signed in to change notification settings - Fork 383
wrong time occasionally #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm using the (great!) library on an ESP8266 too. I also experience the problem that in some cases the NTP time returned is 00:00:xx. I guess this happens when the connection to the NTP server fails. I checked the source of the library to look for a fail/success flag but did not find any :-( Perhaps the update() function could return a boolean that indicates the validity of the NTP time? |
The timeout is currently 1 second (10ms * 100 retry attempts). So, if the request or response gets "lost",
Another option is to have a |
I don't see a reason not to return a bool from |
As a workaround i use the value of getRawTime(). The sketch looks something like:
For the current time the value is something like: 1460479647 As a rule I get a valid NTP time within a couple of minutes after reboot (retry every minute). |
Ok, what do we want the behaviour to be for:
|
That is a good summary. Looks good. That should be useful to determine if the update succeed. We need to ensure that if |
Hmm, can't we make it rely on This does not cover a mixed use of |
It looks like this isn't working correctly now, otherwise this issue should not be present in 2.0.0. But it would be great to find why this isn't currently working. |
Pull request #22 includes an updated() method for checking to see if the time has ever been updated. |
Hi,
I'm using the library (great job by the way) with an ESP-12 and I'm publishing some data to MQTT server, including time, then shutting down for 2 min's (Deep sleep) then starting again.
sometimes the time returned is 00:00:12 ~(the seconds vary) mostly the time returned is correct.
Is there a minimum time for the server to respond, is the 00:00:12 time returned because the server has not responded in time?
Any thoughts?
The text was updated successfully, but these errors were encountered: