Skip to content
Snippets Groups Projects

fix(utime.c): Fix time zone offset handling in time_ms

Merged Ferdinand Bachmann requested to merge yrlf/firmware:fix-utime-time_ms into master

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

Merge request reports

Merge request pipeline #3727 passed

Merge request pipeline passed for 937fc82c

Approval is optional

Merged by rahixrahix 5 years ago (Aug 31, 2019 1:16pm UTC)

Merge details

  • Changes merged into master with f3ae4128.
  • Deleted the source branch.

Pipeline #3743 passed

Pipeline passed for f3ae4128 on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading