You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some questions that have come up about using Instants:
What meaning does Instant -= Duration have?
What are the preconditions on the instant and the duration, so that it does not panic or cause arithmetic overflow assertions? One user noticed that instant -= duration can trip this assertion (specifically on Windows).
The zero point of Instant is not specified and could be any time before the start of the process. If you want to ensure that you do not get any underflow errors, then do not attempt to create an Instant representing a time before the process was spawned.
It causes Instant to have the value of an Instant created Duration time before its original value.
What are the preconditions on the instant and the duration, so that it does not panic or cause arithmetic overflow assertions?
Instant currently wraps the platform-specific monotonic time type, so the overflow bounds depend on the system. Some probably safe assumptions would be to not create Instants from before your process started or Instants more than a century or so in the future. I don't know what we specifically want to guarantee here though.
Activity
retep998 commentedon Oct 24, 2017
The zero point of
Instantis not specified and could be any time before the start of the process. If you want to ensure that you do not get any underflow errors, then do not attempt to create anInstantrepresenting a time before the process was spawned.steveklabnik commentedon Jan 10, 2019
@rust-lang/libs: if you can articulate which aspects of this API are guaranteed, I'm happy to document them.
sfackler commentedon Jan 10, 2019
It causes
Instantto have the value of anInstantcreatedDurationtime before its original value.Instantcurrently wraps the platform-specific monotonic time type, so the overflow bounds depend on the system. Some probably safe assumptions would be to not createInstants from before your process started orInstantsmore than a century or so in the future. I don't know what we specifically want to guarantee here though.time: Implement SystemTime::{MIN, MAX}
time: Implement SystemTime::{MIN, MAX}
time: Implement SystemTime::{MIN, MAX}
Rollup merge of rust-lang#148825 - cvengler:time_systemtime_limits, r…
Rollup merge of rust-lang#148825 - cvengler:time_systemtime_limits, r…
Rollup merge of rust-lang#148825 - cvengler:time_systemtime_limits, r…
Rollup merge of rust-lang#148825 - cvengler:time_systemtime_limits, r…
Rollup merge of rust-lang#148825 - cvengler:time_systemtime_limits, r…
Rollup merge of rust-lang#148825 - cvengler:time_systemtime_limits, r…
Rollup merge of rust-lang#148825 - cvengler:time_systemtime_limits, r…
Rollup merge of rust-lang#148825 - cvengler:time_systemtime_limits, r…
Unrolled build for #148825
Rollup merge of #148825 - cvengler:time_systemtime_limits, r=ChrisDenton