Closed
Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: nodemcu v3 lolin (with esp8266ex)
- Core Version: 3.1.2
- Development Env: arduino ide 2.3.3
- Operating System: windows 10
Settings in IDE
- Module: nodemcu 1.0
- Flash Mode: i dont know
- Flash Size: 4mb
- lwip Variant: v2 low memory
- Reset Method: dont know
- Flash Frequency: dont know
- CPU Frequency: 80mhz
- Upload Using: serial
- Upload Speed: 115200 baud 8n1 no flow control, send line mode,
<LF>
endlines
Problem Description
- ntp is not even mentioned time in readthedocs documentation (btw the search feature is broken so i had to look the entire site), i wouild like to find a "doxigen-like" documentation about esp8266 sntp functions
- but at least i see there is an included example NTP-TZ-DST
- the example is very full featured, but very complicated and hard to understand too, could had been better splitted in many specific "minimal" ones (there are a lot of complaints everywhere about this)... anyway i set up my wifi credentials, flash and run blindly to see in action
- there are no clear info about sntp library functions, i just want to sync my
time()
function correctly - does
configTime(MYTZ, "pool.ntp.org");
saves configuration in flash? because if it does, which could be a safe way to get ntp time without wearing out the flash each time? (see what happened to this guy) - when i run the example it displays year "124", it is shifted 1900 years back (ntp protocol epoch is 1900, unlike unix epoch)
- is not enough with adding 1900 to year, there are a lot of further related calculations like: days of week, leap years, moon phases, sunrise/sunset hours, star position, equinox/solstices, scheduled functions, and many other that require correct full dates... i believe
time()
should return CURRENT UTC timestamp andlocaltime()
should translate to local time according timezone set earlier - i remember some avr arduino time libraries that uses avr libc time.h constans to correct these values on set_system_time() before and immediately after got ntp time like NTP_OFFSET
set_system_time(ntp_timestamp - NTP_OFFSET);
- i think these corrections must be done internally and transparently by the library itself, or at least be fixed BEFORE calling
configTime()
by defining some macro constant or callback function to correct time when configTime() will set system time - is this project abandoned?, because forum is closed (nobody anwers esp32.com subforum), there is no new commits in months, last stable release is about 1.5 years old, this project is based in NONOS sdk that was obsoleted time ago by espressif in favor of RTOS one.... please dont conplain me about posting here because seems all support channels are dying
MCVE Sketch
// just the full NTP-TZ-DST example sketch shipped with esp8266-arduino project version 3.1.2
Debug Messages
localtime: isdst=0 yday=321 wday=0 year=124 mon=10 mday=17 hour=0 min=31 sec=11
gmtime: isdst=0 yday=321 wday=0 year=124 mon=10 mday=17 hour=0 min=31 sec=11
clock: 60s + 74079000ns
millis: 60074
micros: 60074115
gtod: 1731803471s + 344538us
time: 1731803471
timezone: GMT0BST,M3.5.0/1,M10.5.0
ctime: Sun Nov 17 00:31:11 2024
sntp0: pool.ntp.org (64.176.3.116) - IPv6: No - Reachability: 1
time(): 1731803471 gettimeofday(): 1731803471.973050 seconds are unchanged
time(): 1731803472 gettimeofday(): 1731803472.024875 <-- seconds have changed
Metadata
Metadata
Assignees
Labels
No labels