From d54bc6ba55d201772db00362e7b02903e4ddf646 Mon Sep 17 00:00:00 2001 From: Janik Rabe Date: Mon, 6 Aug 2018 14:26:01 +0300 Subject: [PATCH] CmdSummary: Do not extend end time beyond end of day When showing a summary, set the end time to the current time on the last day only. This prevents over-counting of time when a tracked interval covers multiple days. Fixes test TestSummary.test_with_open_interval when the system time is between midnight and 01:00 AM. --- src/commands/CmdSummary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/CmdSummary.cpp b/src/commands/CmdSummary.cpp index d855840e..15327a6e 100644 --- a/src/commands/CmdSummary.cpp +++ b/src/commands/CmdSummary.cpp @@ -126,7 +126,7 @@ int CmdSummary ( // Intersect track with day. auto today = day_range.intersect (track.range); - if (track.range.is_open () && day <= Datetime ()) + if (track.range.is_open () && day <= Datetime () && today.end > Datetime ()) today.end = Datetime (); std::string tags = join(", ", track.tags());