Uploaded image for project: 'Rust Driver'
  1. Rust Driver
  2. RUST-1677

Add duration_since methods to DateTime

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • bson-2.7.0
    • Affects Version/s: None
    • Component/s: BSON
    • None

      There's currently not an easy way to calculate the time elapsed between two bson::DateTimes without converting to other types. We should implement subtraction methods to do this; we can likely copy checked_sub, saturating_sub, and impl Sub from OffsetDateTime: https://docs.rs/time/latest/time/struct.OffsetDateTime.html#

       

      Edit: a more accurate analogy would be the checked_duration_since and saturating_duration_since methods in std::time::Instant.

            Assignee:
            isabel.atkinson@mongodb.com Isabel Atkinson
            Reporter:
            isabel.atkinson@mongodb.com Isabel Atkinson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: