]> git.lizzy.rs Git - rust.git/commitdiff
Add a note about the panic behavior of math operations on time objects
authorAlexis Bourget <alexis.bourget@gmail.com>
Sat, 5 Sep 2020 20:37:36 +0000 (22:37 +0200)
committerAlexis Bourget <alexis.bourget@gmail.com>
Sat, 5 Sep 2020 20:37:36 +0000 (22:37 +0200)
library/std/src/time.rs

index 73c0a7b403a7bed8382bbd9d693efa1bb259b297..42f1cde3e1c8fb8f172feff09d19a4459c07d7ce 100644 (file)
 /// [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);
 /// [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);