Skip to content

Commit

Permalink
fix: wrong format
Browse files Browse the repository at this point in the history
  • Loading branch information
cardigan1008 committed Jul 28, 2024
1 parent 259097b commit e9386ed
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/duration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,13 +538,11 @@ impl Duration {
/// assert_eq!(two_hours_three_min.floor(1.hours() + 5.minutes()), 1.hours() + 5.minutes());
/// ```
pub fn floor(&self, duration: Self) -> Self {
Self::from_total_nanoseconds(
if duration.total_nanoseconds() == 0 {
0
} else {
self.total_nanoseconds() - self.total_nanoseconds() % duration.total_nanoseconds()
}
)
Self::from_total_nanoseconds(if duration.total_nanoseconds() == 0 {
0
} else {
self.total_nanoseconds() - self.total_nanoseconds() % duration.total_nanoseconds()
})
}

/// Ceils this duration to the closest provided duration
Expand Down

0 comments on commit e9386ed

Please sign in to comment.