Open
Description
Recently I ran into the problem that the NTP-sketch from https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/ suddenly displays incorrect dates and year, time is correct. Example output before and after timesync:
08:29:15
Epoch Time: 2085985755
Month day: 6
Week Day: Thursday
Month: 8
Month name: August
Year: -3135390
Current date: -3135390-8-6
19:19:31
Epoch Time: 1622834371
Month day: 2
Week Day: Friday
Month: 12
Month name: December
Year: -3135405
Current date: -3135405-12-2
I thought I'd tracked down the cause of the problem, this issue appeared after having updated the ESP8266 boards platform to 3.0.0, downgrading it and reflashing the sketch solves the problem.
Yesterday I reported it at esp8266/Arduino#8118, but according to who responded, this problem is in the NTP library, it might have something to do with 32 and 64 bit time_t.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
chalkmaroon commentedon Jun 25, 2021
Exactly the same bug here, with the exception that no downgrade helped in my code. I've tried 3.2.0, 3.1.0 and 3.0.0.
The version 2.0.0 seemd to be too old, since this doesn't even compile my code, which worked fine, the last months.
bartgrefte commentedon Jun 25, 2021
3.2.0? I wasn't referring to the version of the NTP library, but the ESP8266 board library. The most recent version for that is 3.0.0, To fix this problem that library (not the NTP library) has to be downgraded to 2.7.*
chalkmaroon commentedon Jun 26, 2021
Oh, I'm sorry, I didn't read your post carefully enough and yes you're right, I downgraded the board library and the error disappeared.
sercona commentedon Jul 2, 2021
this is scary, I did a grep -r for time_t in my $HOME/.arduino15 area and it was a random mix of 32 unsigned, 32 signed, and 64 unsigned (good!) types.
some from lwip, some from esp, some from other areas.
my god, this should really be cleaned up, somehow ;)
in this day and age, I'm not sure why we're not all using 64bit time_t types. anyone have a good reason why we're still stuck in 32 bit land for time types? didn't we already fix things back in y2k days? (half serious).
andreaguiar commentedon Jul 17, 2021
same problem here :(
I noticed that when I reboot the ESP8266 the date is correct at first, it's only when I update it that it goes wrong...
is someone working on this issue, or did you guys found a temporary fix (excluding the downgrade)?
yoonhong98 commentedon Nov 5, 2021
Hello, I am having the same problem. I did downgrade the ESP8266 to 2.3.0 but it still showing me different date after a while.
bsvdoom commentedon Nov 5, 2021
Use 2.7.4.
yoonhong98 commentedon Nov 7, 2021
Changed to 2.7.4 but the time still changes and addition with error exception(9)
bsvdoom commentedon Nov 7, 2021
bsvdoom commentedon Nov 7, 2021
ind03 commentedon Aug 11, 2023
Time is ok, but date is wrong for me too.
bsvdoom commentedon Aug 25, 2023