From: Alexis Bourget Date: Sat, 5 Sep 2020 20:37:36 +0000 (+0200) Subject: Add a note about the panic behavior of math operations on time objects X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=492826ac144666c75d68bc0a0121453ecc08561f;p=rust.git Add a note about the panic behavior of math operations on time objects --- diff --git a/library/std/src/time.rs b/library/std/src/time.rs index 73c0a7b403a..42f1cde3e1c 100644 --- a/library/std/src/time.rs +++ b/library/std/src/time.rs @@ -100,6 +100,11 @@ /// [clock_time_get (Monotonic Clock)]: https://nuxi.nl/cloudabi/#clock_time_get /// /// **Disclaimer:** These system calls might change over time. +/// +/// > Note: mathematical operations like [`add`] may panic if the underlying +/// > structure cannot represent the new point in time. +/// +/// [`add`]: Instant::add #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[stable(feature = "time2", since = "1.8.0")] pub struct Instant(time::Instant); @@ -174,6 +179,11 @@ /// [GetSystemTimeAsFileTime]: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime /// /// **Disclaimer:** These system calls might change over time. +/// +/// > Note: mathematical operations like [`add`] may panic if the underlying +/// > structure cannot represent the new point in time. +/// +/// [`add`]: SystemTime::add #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[stable(feature = "time2", since = "1.8.0")] pub struct SystemTime(time::SystemTime);