-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
mktime(3) requires call to tzset(3) with esp-idf v4.4.4 (IDFGH-10187) #11455
Comments
Fix a bug where the system time is synchronized from localtime instead of UTC. ESP-IDF mostly considers system time is UTC and ignores timezone argument of `settimeofday`. Also add a workaround for issue espressif/esp-idf#11455 Signed-off-by: Paul Guyot <pguyot@kallisys.net>
In v4.4.4 esp32 is using the version of newlib from ROM. which is quite a bit older (based on Newlib 2.2.0 if i'm not mistaken) For 5.0 and newer we support 64bit time, so we use the newer newlib that comes with the toolchain, not the ROM version. This version of newlib seems to call |
Indeed, in As opposed to |
@pguyot Seeing as the issue is in ROM code and there is a simple SW work-around I think our response will be to update our system-time docs to reflect this inconsistency with the posix standard. |
…called before localtime/mktime() According to the posix standard localtime/mktime should use timezone information as though localtime/mktime() calls tzset(), but this is not the case in older versions of Newlib. Closes #11455
Answers checklist.
IDF version.
v4.4.4-435-g7641c8ef4f
Operating System used.
macOS
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
N/A
Power Supply used.
USB
What is the expected behavior?
According to POSIX standard, the following code should print equal=1.
What is the actual behavior?
Using esp-idf v4.4.4, this fails.
Instead, the output is:
If the workaround line is uncommented (
tzset(3)
is called before callingmktime(3)
), it works.The problem does not occur with esp-idf 5.0 (release/v5.0 branch,
v5.0.2-153-gbfe07cbef9
)Steps to reproduce.
Compile the code above with esp-idf v4.4.4 (release/v4.4 branch)
Run it on real hardware or using qemu.
Debug Logs.
More Information.
No response
The text was updated successfully, but these errors were encountered: