Sorry, my description of what is expected was incorrect.
I think just looking at the code shows that the current code is wrong,
since the first time through the loop, "seconds" is uninitialized, which
is incorrect.
A better set of steps to reproduce:
/usr/bin/worklog ~/worklog/projects time.log
Add time to a project and quit
Contents of time.log:
ProjectB : 1.00 seconds : finished Fri Oct 20 06:01:20 2023
-- Worklog summary begins : Fri Oct 20 06:01:16 2023 --
ProjectA : total 0.00 seconds
-- Worklog summary ends : Fri Oct 20 06:01:21 2023 --
/usr/bin/worklog ~/worklog/projects time.log
Quit immediately:
New contents of time.log:
-- Worklog summary begins : Fri Oct 20 06:01:27 2023 --
ProjectA : total 0.00 seconds
-- Worklog summary ends : Fri Oct 20 06:01:28 2023 --
ProjectB isn't listed at all.
What it should look like is this:
Complete contents of time.log when running the aboe steps after the patch
is applied:
ProjectB : 1.00 seconds : finished Fri Oct 20 06:04:27 2023
-- Worklog summary begins : Fri Oct 20 06:04:24 2023 --
ProjectB : total 1.00 seconds
-- Worklog summary ends : Fri Oct 20 06:04:28 2023 --
-- Worklog summary begins : Fri Oct 20 06:04:33 2023 --
ProjectB : total 1.00 seconds
-- Worklog summary ends : Fri Oct 20 06:04:34 2023 --