You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug does not happen on XIAO ESP32-C3 with the same code. On XIAO ESP32-C3 there seams to be an background worker that syncronizes with ntp as soon as connection to internet is made. It does not need a manual ntp request.
The text was updated successfully, but these errors were encountered:
Hi, I see the same behavior on both an S2 and C3 QT PY.
It seems that the file time does not follow time.localtime() (set by the time source) but the internal RTC time.
I don't know enough about that to say if it's a bug or an (undocumented ?) expected behavior.
(The C code for file access might not want to rely on calling a python time source).
But file times are correct for me when not setting the time source and instead use:
rtc.RTC().datetime=ntp.datetime
Which might mean that you need to manually call that from time to time to keep it in sync.
Also note that the RTC time should be kept when the code is reloaded until the board is hard reset.
I see no difference between the QT PY C3 and the QT PY S2 with the same code (in both your code, and my modified version the boards behave identical to each other). Maybe you set the RTC on the C3 in a previous test or some other code ?
First run after changing the code as mentioned above:
CircuitPython version
Code/REPL
Behavior
file date is not synchronized with the system time.
code.py output:
struct_time(tm_year=2000, tm_mon=1, tm_mday=1, tm_hour=1, tm_min=0, tm_sec=14, tm_wday=5, tm_yday=1, tm_isdst=-1)
struct_time(tm_year=2024, tm_mon=12, tm_mday=28, tm_hour=21, tm_min=56, tm_sec=10, tm_wday=5, tm_yday=363, tm_isdst=-1)
struct_time(tm_year=2024, tm_mon=12, tm_mday=28, tm_hour=21, tm_min=56, tm_sec=10, tm_wday=5, tm_yday=363, tm_isdst=-1)
struct_time(tm_year=2024, tm_mon=12, tm_mday=28, tm_hour=21, tm_min=56, tm_sec=15, tm_wday=5, tm_yday=363, tm_isdst=-1)
file_date: struct_time(tm_year=2000, tm_mon=1, tm_mday=1, tm_hour=1, tm_min=0, tm_sec=18, tm_wday=5, tm_yday=1, tm_isdst=-1)
struct_time(tm_year=2024, tm_mon=12, tm_mday=28, tm_hour=21, tm_min=56, tm_sec=20, tm_wday=5, tm_yday=363, tm_isdst=-1)
file_date: struct_time(tm_year=2000, tm_mon=1, tm_mday=1, tm_hour=1, tm_min=0, tm_sec=24, tm_wday=5, tm_yday=1, tm_isdst=-1)
Description
No response
Additional information
This bug does not happen on XIAO ESP32-C3 with the same code. On XIAO ESP32-C3 there seams to be an background worker that syncronizes with ntp as soon as connection to internet is made. It does not need a manual ntp request.
The text was updated successfully, but these errors were encountered: