Skip to content

Commit

Permalink
Complete the std::time documentation to warn about the inconsistencie…
Browse files Browse the repository at this point in the history
…s between OS
  • Loading branch information
poliorcetics committed Jun 15, 2020
1 parent f6072ca commit 9e51008
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/libstd/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ pub use core::time::Duration;
/// }
/// ```
///
/// # OS-specific behaviors
///
/// An `Instant` is a wrapper around system-specific types and it may behave
/// differently depending on the underlying operating system. For example,
/// the following snippet is fine on Linux but panics on macOS:
///
/// ```no_run
/// use std::time::{Instant, Duration};
///
/// let now = Instant::now();
/// let max_nanoseconds = u64::MAX / 1_000_000_000;
/// let duration = Duration::new(max_nanoseconds, 0);
/// println!("{:?}", now + duration);
/// ```
///
/// # Underlying System calls
/// Currently, the following system calls are being used to get the current time using `now()`:
///
Expand Down

0 comments on commit 9e51008

Please sign in to comment.