Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By AcmeUK
#25426 Hi Martin
Yes very odd!
Only reason to make a request every 30 sec is testing the script.

Yes I normally would only make a request once a day. BUT based on what I have observed running this test my confidence in the result returned is now less than 100%.
User avatar
By martinayotte
#25436 Hi AcmeUK,

I've decided to investigate ...
I've took the NTPClient demo sketch as is from build 1.6.5-947-g39819f0, but I wasn't able to reproduce the problem.
Can you provide your code ?

Code: Select allsending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648118034
Unix time = 1439129234
The UTC time is 14:07:14
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648118045
Unix time = 1439129245
The UTC time is 14:07:25
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648118056
Unix time = 1439129256
The UTC time is 14:07:36
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648118067
Unix time = 1439129267
The UTC time is 14:07:47
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648118078
Unix time = 1439129278
The UTC time is 14:07:58
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648118089
Unix time = 1439129289
The UTC time is 14:08:09
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648118100
Unix time = 1439129300
The UTC time is 14:08:20
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648118111
Unix time = 1439129311
The UTC time is 14:08:31
User avatar
By AcmeUK
#25439 Hi Martin

The code is that from the link given by Gerard in the first post. All I did was add my wifi details and modify the serial output to 74880 baud and to give a 'tighter' output.

I have got a new copy of the code (by cut and paste) and get the same result, see here :-
....
WiFi connected
IP address:
192.168.1.85
Starting UDP
Local port: 2390
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648119586
Unix time = 1439130786
The UTC time is 14:33:06
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648119586
Unix time = 1439130786
The UTC time is 14:33:06
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648119586
Unix time = 1439130786
The UTC time is 14:33:06
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648119586
Unix time = 1439130786
The UTC time is 14:33:06
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648119586
Unix time = 1439130786
The UTC time is 14:33:06
sending NTP packet...
packet received, length=48
Seconds since Jan 1 1900 = 3648119633
Unix time = 1439130833
The UTC time is 14:33:53


The only changes I made were to provide my wifi details and change the baud rate to 74880 so that I could see the boot messages.

I am using the Arduino IDE v1.6.5 on Win 7 64bit.

Thanks for your interest.

BillP