Closed VishalDhayalan closed 5 years ago
The way to get rid of this issue is to adjust your "setSendInterval" and "setRecvTimeout". I saw the same bleep, and that fixed my issue.
I've just changed the pool server to time.google.com and it works without any problems. What does the setSendInterval and set RecvTimeout do?
What is happening is that the default values are a bit too fast, and so if you are trying to request from the NTP server too fast it happens that you might get bad data and that's when you see the erroneous data.
And yeah you should also choose the closest server to you for best results.
Hi. I'm quite new at this. How would one use "setSendInterval" and "setRecvTimeout"?
Hi. I'm quite new at this. How would one use "setSendInterval" and "setRecvTimeout"?
larsss83 if you open NTPtimeESP.h you can see those two are public methods.
class NTPtime {
public:
NTPtime(String NTPtime);
strDateTime getNTPtime(float _timeZone, int _DayLightSaving);
void printDateTime(strDateTime _dateTime);
bool setSendInterval(unsigned long _sendInterval); // in seconds
bool setRecvTimeout(unsigned long _recvTimeout); // in seconds
So if you set your NTP server like this:
NTPtime NTPch("ch.pool.ntp.org");
You would call them as follows, the parameter is how fast you want the interval, and timeout. Set interval accordingly, until you see data OK.
NTPch.setSendInterval(1);
NTPch.setRecvTimeout(1);
Thanks!
I use dk.pool.ntp.org and got the same issue. Please fix valid() method
2019-1-24-5 11H 9M 1S 2019-1-24-5 11H 9M 2S 2019-1-24-5 11H 9M 3S 2019-1-24-5 11H 9M 4S 2036-2-7-5 7H 28M 16S 2036-2-7-5 7H 28M 16S 2036-2-7-5 7H 28M 16S 2036-2-7-5 7H 28M 16S 2036-2-7-5 7H 28M 16S 2036-2-7-5 7H 28M 16S 2019-1-24-5 11H 9M 58S 2019-1-24-5 11H 9M 59S 2019-1-24-5 11H 10M 0S 2019-1-24-5 11H 10M 1S 2019-1-24-5 11H 10M 2S 2019-1-24-5 11H 10M 3S
rgry did you try to adjust values like suggested to Lars? Try something higher than 1. 1 is the default.
I am having the same problem. Increasing the send interval and the receive timeout had no effect for me...
@SelfTenure Please post your code, and are you using the closest ntp pool?
@kodaman2 I guess, the problems I had with incorrect times, where temporay glitches – I cannot reproduce the invalid dates and times. Thank you anyways ;)
It often returns a dateTime that's incorrect by a huge amount (2036-2-7-5) and the time when that happens is expectedly incorrect as well. But what makes this error really problematic is it classes this incorrect dateTime as valid. It is always the same incorrect dateTime though (as shown below).
This is the code: