From 8f118fe0ca8cb28c91b10f66336ae7868858fb54 Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Mon, 4 Sep 2023 19:19:02 +0200 Subject: [PATCH] Clarify `Timelike::num_seconds_from_midnight` is a simple mapping --- src/traits.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/traits.rs b/src/traits.rs index 079db53d83..1094bd822b 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -316,6 +316,11 @@ pub trait Timelike: Sized { fn with_nanosecond(&self, nano: u32) -> Option; /// Returns the number of non-leap seconds past the last midnight. + /// + /// Every value in 00:00:00-23:59:59 maps to an integer in 0-86399. + /// + /// This method is not intended to provide the real number of seconds since midnight on a given + /// day. It does not take things like DST transitions into account. #[inline] fn num_seconds_from_midnight(&self) -> u32 { self.hour() * 3600 + self.minute() * 60 + self.second()