File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,21 @@ pub use core::time::Duration;
6060/// }
6161/// ```
6262///
63+ /// # OS-specific behaviors
64+ ///
65+ /// An `Instant` is a wrapper around system-specific types and it may behave
66+ /// differently depending on the underlying operating system. For example,
67+ /// the following snippet is fine on Linux but panics on macOS:
68+ ///
69+ /// ```no_run
70+ /// use std::time::{Instant, Duration};
71+ ///
72+ /// let now = Instant::now();
73+ /// let max_nanoseconds = u64::MAX / 1_000_000_000;
74+ /// let duration = Duration::new(max_nanoseconds, 0);
75+ /// println!("{:?}", now + duration);
76+ /// ```
77+ ///
6378/// # Underlying System calls
6479/// Currently, the following system calls are being used to get the current time using `now()`:
6580///
You can’t perform that action at this time.
0 commit comments