Android-SimpleTimeTracker icon indicating copy to clipboard operation
Android-SimpleTimeTracker copied to clipboard

Consider seconds/minutes precision when registering timestamps

Open zkck opened this issue 9 months ago • 2 comments

For me and users that use the app with defaults, taking into account the seconds when registering timestamps can lead to confusing off-by-one summaries, that can only be explained when enabling "show seconds" in the settings.

Personally I think that if "show seconds" is off, that means that the user doesn't care about second-level accuracy, and thus that timestamps should be registered without seconds (that they are set to zero). This would then avoid confusion in aggregated views.

If this is implemented, we maybe could then consider naming the setting "Precision" with a toggle for minutes or seconds, rather than "show seconds", since it is now serves a broader purpose.

What do you think?

zkck avatar Apr 27 '25 23:04 zkck

Hello! Unfortunately this is hard to solve. Currently not fond of idea of losing data precision of timestamps. Ideal solution would be saving seconds but not counting them on the ui, but this is also hard to implement. Will have to look into it more.

Related to #174

Razeeman avatar Jun 02 '25 08:06 Razeeman

Ideal solution would be saving seconds but not counting them on the ui, but this is also hard to implement

It could be easy to compute the total duration and average duration, but hard to do other operations.

Indeed, the value we want, sum of truncated durations, equals sum of durations - sum of seconds. Average is just this sum of truncated durations divided by the number of records.


truncated duration:

timestamps should be registered without seconds (that they are set to zero)


Explanations

We notice the following mathematical property:

single duration = truncated duration (only minutes) + seconds
=>
sum of durations = sum of truncated durations + sum of seconds
<=>
sum of truncated durations = sum of durations - sum of seconds

Example:

00:12:34 = 00:12:__ + __:__:34
<=>
00:12:00 = 00:12:34 - 00:00:34
^-------   ^-------   ^------- just the seconds
   |          '-  full duration
   '- truncated duration

Full example:

RECORDS
  timestamp ≈ truncated
⋅  00:14:55 ≈ {00:14}
⋅  00:14:44 ≈ {00:14}
⋅  00:15:33 ≈ {00:15}
⋅  00:15:22 ≈ {00:15}

TOTAL DURATION
 = 01:02:34 exact
 ≈ {00:58} truncated  <-- the value we want (sum of truncated durations)
≈ (01:02:34) - (0:55 + 0:44 + 0:33 + 0:22)

cogk avatar Jun 02 '25 14:06 cogk