Skip to content

Commit

Permalink
Clarify Timelike::num_seconds_from_midnight is a simple mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Sep 6, 2023
1 parent 1903778 commit f4aefc7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/traits.rs
Expand Up @@ -316,6 +316,11 @@ pub trait Timelike: Sized {
fn with_nanosecond(&self, nano: u32) -> Option<Self>;

/// 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()
Expand Down

0 comments on commit f4aefc7

Please sign in to comment.