← index #7137PR #695
Off-topic · high · value 1.055
QUERY · ISSUE

ntptime.py settime() does not cope with errors

openby peterhinchopened 2021-04-20updated 2022-07-31

This arose in the forum.

If an exception occurs in the time() function, msg is not updated so a value of -NTP_DELTA is returned. If this is the intended mechanism for reporting exceptions, settime() should check for this and avoid updating the RTC.

Or perhaps the finally clause in time() should re-raise the exception?

CANDIDATE · PULL REQUEST

ntptime: Allows manual timezone setting.

closedby Wind-stormgeropened 2023-06-29updated 2023-09-06

Adds only a minimal amount of code, allowing manual setting of the timezone.

Similar to this PR, but it's closed. https://github.com/micropython/micropython-lib/pull/634

2 comments
MrEbbinghaus · 2023-08-31

Same issue as in: https://github.com/micropython/micropython-lib/pull/715
See my comment: https://github.com/micropython/micropython-lib/pull/715#issuecomment-1701200071

projectgus · 2023-09-06

Thanks for submitting this PR. Everyone seems to agree MicroPython should solve this problem, but the best place is probably not in the ntptime module (as NTP itself doesn't know about timezones, and numeric Unix timestamps are generally always in UTC.).

I've started a Discussion here to talk about the possible ways forward for this:
https://github.com/orgs/micropython/discussions/12378

Please feel free to reply there with any other thoughts or suggestions.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied