From f00c4b94640b73fff7f5f07a9abb35a042eac62f Mon Sep 17 00:00:00 2001 From: Thomas Lauf Date: Sat, 8 Aug 2020 23:03:47 +0200 Subject: [PATCH] Use `Range::is_started ()`/`Range::is_ended ()` instead of accessing `range.start`/`range.end` Signed-off-by: Thomas Lauf --- src/commands/CmdContinue.cpp | 2 +- src/commands/CmdModify.cpp | 2 +- src/commands/CmdReport.cpp | 4 ++-- src/commands/CmdStop.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/CmdContinue.cpp b/src/commands/CmdContinue.cpp index aee43aca..1fea9912 100644 --- a/src/commands/CmdContinue.cpp +++ b/src/commands/CmdContinue.cpp @@ -98,7 +98,7 @@ int CmdContinue ( Datetime start_time; Datetime end_time; - if (filter.start.toEpoch () != 0) + if (filter.is_started ()) { start_time = filter.start; end_time = filter.end; diff --git a/src/commands/CmdModify.cpp b/src/commands/CmdModify.cpp index 0bdaf569..27a63a60 100644 --- a/src/commands/CmdModify.cpp +++ b/src/commands/CmdModify.cpp @@ -83,7 +83,7 @@ int CmdModify ( } assert (intervals.size () == 1); - if (filter.start.toEpoch () == 0) + if (! filter.is_started ()) { throw std::string ("No updated time specified. See 'timew help modify'."); } diff --git a/src/commands/CmdReport.cpp b/src/commands/CmdReport.cpp index 4ff79292..43b2853a 100644 --- a/src/commands/CmdReport.cpp +++ b/src/commands/CmdReport.cpp @@ -93,8 +93,8 @@ int CmdReport ( auto filter = cli.getFilter (); auto tracked = getTracked (database, rules, filter); - rules.set ("temp.report.start", filter.start.toEpoch () > 0 ? filter.start.toISO () : ""); - rules.set ("temp.report.end", filter.end.toEpoch () > 0 ? filter.end.toISO () : ""); + rules.set ("temp.report.start", filter.is_started () ? filter.start.toISO () : ""); + rules.set ("temp.report.end", filter.is_ended () ? filter.end.toISO () : ""); rules.set ("temp.report.tags", joinQuotedIfNeeded (",", filter.tags ())); rules.set ("temp.version", VERSION); diff --git a/src/commands/CmdStop.cpp b/src/commands/CmdStop.cpp index 4de2661b..89b4ca7b 100644 --- a/src/commands/CmdStop.cpp +++ b/src/commands/CmdStop.cpp @@ -73,7 +73,7 @@ int CmdStop ( // If a stop date is specified (and occupies filter.start) then use // that instead of the current time. - if (filter.start.toEpoch () != 0) + if (filter.is_started ()) { if (modified.start >= filter.start) {