Skip to content

Commit

Permalink
Rollup merge of #136301 - hkBst:patch-33, r=thomcc
Browse files Browse the repository at this point in the history
Improve instant docs

This should be enough to close #79881.
  • Loading branch information
matthiaskrgr authored Feb 19, 2025
2 parents 2c380a4 + 9cb7432 commit 2c1e1bd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions library/std/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,17 @@ use crate::sys_common::{FromInner, IntoInner};
/// use std::time::{Instant, Duration};
///
/// let now = Instant::now();
/// let max_seconds = u64::MAX / 1_000_000_000;
/// let duration = Duration::new(max_seconds, 0);
/// let days_per_10_millennia = 365_2425;
/// let solar_seconds_per_day = 60 * 60 * 24;
/// let millenium_in_solar_seconds = 31_556_952_000;
/// assert_eq!(millenium_in_solar_seconds, days_per_10_millennia * solar_seconds_per_day / 10);
///
/// let duration = Duration::new(millenium_in_solar_seconds, 0);
/// println!("{:?}", now + duration);
/// ```
///
/// For cross-platform code, you can comfortably use durations of up to around one hundred years.
///
/// # Underlying System calls
///
/// The following system calls are [currently] being used by `now()` to find out
Expand Down

0 comments on commit 2c1e1bd

Please sign in to comment.