← index #2130Issue #3523
Related · high · value 0.714
QUERY · ISSUE

Timezone support for "time" module

openby puuuopened 2016-05-30updated 2024-09-29
enhancement

From the release notes of MicroPython ESP8266 firmware v1.8 is clear, ntptime only supports UTC. I agree, time zone handling is out of the focus of ntptime. But it would be nice, if ntptime.settime() would support a offset argument, which is be added to ntptime.time() before setting the rtc.

Something like ntptime.settime(offset=2*3600) to provide CEST.
Then, getting the local time is easy as time.localtime() (if #2097 is solved).

I believe, this is a simple api enhancement. Later, a timezone module may calculate the offset by time zone and daylight saving.

I can provide a pull request, but I am not sure about the api and what unit (seconds, minutes or hours) is advisable for the offset. Also the PR may conflict with #2121 .

CANDIDATE · ISSUE

esp8266/modules/ntptime: More accurate NTP syncing

openby puhitakuopened 2017-12-28updated 2024-09-19
enhancementport-esp8266

At present ntptime doesn't care about sub-second part (fraction part of NTP reply.)

I've wrote some lines which handles it and syncs RTC milliseconds-accurate.
https://github.com/puhitaku/micropython/commit/5dd5bed21677250f1b26da2a48558b03c08d9ca1

I think it won't make any incompatibility even if I change this API to set millis implicitly because utime.datetime doesn't care about millis but I can't guarantee it so it's why I adopted kwarg.

Takumi

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