The source project of this merge request has been removed.
fix(utime.c): make set_time correctly subtract TZONE_OFFSET
there were two bugs in set_time
:
-
TZONE_OFFSET
is not multiplied by 1000, even thoughepic_rtc_set_milliseconds
was used. -
TZONE_OFFSET
is added in bothtime
andset_time
.set_time
should subtract the timezone offset.
Testcase:
import utime
old = utime.time()
utime.set_time(old)
new = utime.time()
if old != new:
print("time difference:", new - old)
# will print 7607, or 2.11 hours with the old code
# should print 0 or 1 at most
Edited by Ferdinand Bachmann