dominikbraun / timetrace

A simple CLI for tracking your working time.
Apache License 2.0
685 stars 76 forks source link

Only calculate time for current record if it hasn't ended #7

Closed dominikbraun closed 3 years ago

dominikbraun commented 3 years ago

Fixes #4. With this PR, the tracked time displayed with timetrace status is only calculcated using time.Now() if it hasn't ended.

dominikbraun commented 3 years ago

Also, if time isn't tracked at the moment of calling timetrace status, the returned current record and its tracked time will be nil:

https://github.com/dominikbraun/timetrace/blob/265180e40cd1cdb47871d568e70bf666b3090cfd/core/timetrace.go#L100-L110