Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • F firmware
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare
  • Issues 74
    • Issues 74
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 29
    • Merge requests 29
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • External wiki
    • External wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • card10card10
  • firmware
  • Merge requests
  • !283

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

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Ferdinand Bachmann requested to merge yrlf/firmware:fix-utime-time_ms into master Aug 30, 2019
  • Overview 2
  • Commits 1
  • Pipelines 3
  • Changes 1

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
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix-utime-time_ms