From 76e764b706c926eaf1d2e4807a7b3385dd51a8c3 Mon Sep 17 00:00:00 2001 From: FichteFoll Date: Fri, 10 Dec 2021 12:09:37 +0100 Subject: [PATCH] Round timestamps to whole minutes on creation The displayed timestamps were always floored, as were calculated difference and its sum, which meant a duration that seemed like 1 hour was more often than not displayed as 0:59 instead of 1:00. --- src/timesheet.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/timesheet.rs b/src/timesheet.rs index bdcc50e..b6e8786 100644 --- a/src/timesheet.rs +++ b/src/timesheet.rs @@ -35,7 +35,8 @@ impl TimePoint { } fn now() -> Time { - OffsetDateTime::now_local().time() + let raw_time = OffsetDateTime::now_local().time(); + Time::try_from_hms(raw_time.hour(), raw_time.minute(), 0).unwrap() } impl fmt::Display for TimePoint {