We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f6072ca commit 9e51008Copy full SHA for 9e51008
src/libstd/time.rs
@@ -60,6 +60,21 @@ pub use core::time::Duration;
60
/// }
61
/// ```
62
///
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
78
/// # Underlying System calls
79
/// Currently, the following system calls are being used to get the current time using `now()`:
80
0 commit comments