From 492826ac144666c75d68bc0a0121453ecc08561f Mon Sep 17 00:00:00 2001 From: Alexis Bourget Date: Sat, 5 Sep 2020 22:37:36 +0200 Subject: [PATCH] Add a note about the panic behavior of math operations on time objects --- library/std/src/time.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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); -- 2.44.0