fix(utime.c): Fix time zone offset handling in time_ms
Compare changes
+ 2
− 2
@@ -45,8 +45,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(time_time_obj, time_time);
Another bug in utime.c
, this time in utime.time_ms()
:
The time zone offset is added with the wrong sign, as a result of wrong precedence when adding parentheses to the multiplication with 1000:
Testcase:
import utime
s = utime.time()
ms = utime.time_ms()
diff = s - ms // 1000
if diff != 0:
print("time difference:", diff)
# will print 14400, or 4 hours, with the old code
# should print 0