Hey - this is an old question on an almost-closed forum. But it's still showing up in search results and perhaps confusing users.
The link given by the OP as the NTP documentation:
The micropython-lib ntptime library is here: micropython-lib/micropython/net/ntptime at master · micropython/micropython-lib. Please note that it only supports UTC time, with the reason given as "There's currently no timezone support in MicroPython, and the RTC is set in UTC time".
Peter Hinch wrote a version that allows a time offset to be set: micropython-samples/ntptime/ntptime.py at master · peterhinch/micropython-samples. Note that, unlike the micropython-lib version, it doesn't set the RTC to the time returned from the NTP server.
The link given by the OP as the NTP documentation:
is not the official library, and refers to a forked version of MicroPython for some IoT device developed in China.Jibun no kage wrote: ↑Mon Aug 15, 2022 2:16 amReference https://mpython.readthedocs.io/en/maste ... ptime.html...
The micropython-lib ntptime library is here: micropython-lib/micropython/net/ntptime at master · micropython/micropython-lib. Please note that it only supports UTC time, with the reason given as "There's currently no timezone support in MicroPython, and the RTC is set in UTC time".
Peter Hinch wrote a version that allows a time offset to be set: micropython-samples/ntptime/ntptime.py at master · peterhinch/micropython-samples. Note that, unlike the micropython-lib version, it doesn't set the RTC to the time returned from the NTP server.
Statistics: Posted by scruss — Thu Jan 11, 2024 3:44 pm