From d2a784362fbcc8046e3a408aa6b57660364707e7 Mon Sep 17 00:00:00 2001 From: IndrekV Date: Fri, 1 Dec 2017 16:07:28 +0200 Subject: [PATCH] Duration is negative start time when TE is running (lib), #2295 --- src/user.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/user.cc b/src/user.cc index 31b9231567..d4276e4aaf 100644 --- a/src/user.cc +++ b/src/user.cc @@ -161,6 +161,8 @@ TimeEntry *User::Continue( Stop(); + time_t now = time(0); + TimeEntry *result = new TimeEntry(); result->SetCreatedWith(HTTPSClient::Config.UserAgent()); result->SetDescription(existing->Description()); @@ -170,10 +172,10 @@ TimeEntry *User::Continue( result->SetBillable(existing->Billable()); result->SetTags(existing->Tags()); result->SetUID(ID()); - result->SetStart(time(0)); + result->SetStart(now); if (!manual_mode) { - result->SetDurationInSeconds(-time(0)); + result->SetDurationInSeconds(-now); } result->SetCreatedWith(HTTPSClient::Config.UserAgent());