Skip to content

Checked arithmetic is wrong for Durations smaller than 100ns on Windows #149995

Description

@cvengler

I tried this code:

let system_time: SystemTime = ...;

// Add 1ns.
system_time.checked_add(Duration::new(0, 1)).unwrap();

I expected to see this happen: The unwrap to fail because SystemTime on Windows only has an accuracy of 100ns.

Instead, this happened: The addition "works" by returning some, although the value is unchanged from the original one, meaning an addition of a Duration < 100ns is equivalent of adding Duration::ZERO.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-windowsOperating system: WindowsT-libsRelevant to the library team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions