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

[BUG]: time is off by 1 minute in some occasions

Open precla opened this issue 1 year ago • 8 comments

see attached screenshot, should be 7:46.

edit: Seems to me that it considers seconds when calculating the total time.

Screenshot_20240325-083406_Simple_Time_Tracker

precla avatar Mar 28 '24 16:03 precla

Not a bug: the time period 08:29:59 - 16:15:00 is 7h 45m 1s long


edit: Seems to me that it considers seconds when calculating the total time.

edit: yes

cogk avatar Apr 02 '24 14:04 cogk

would it make sense to add the option to ignore seconds?

precla avatar Apr 03 '24 06:04 precla

Hello! Ignoring seconds seems like an easy solution, but I'm on the fence about it because it would probably require some complex logic especially in statistics to recalculate all records without seconds every time statistics is updated. Hope this make sense. At the moment I've added a different representation for the records like this, showing that is a rounded time (shown in attached screenshot). This record is actually 59m 1s long, but shown as 1h if seconds are disabled.

image

Razeeman avatar Apr 26 '24 10:04 Razeeman

Maybe it would be possible to round all timestamps before inserting them in the database (= truly ignoring seconds)?

cogk avatar Apr 26 '24 10:04 cogk

This is also an option, but it would not fix previously created records. Ideally best way would be to store seconds but just ignore them on the ui. But I'm not sure how to do it, maybe it would require too much work and your solution would be implemented in the end :)

Razeeman avatar Apr 26 '24 10:04 Razeeman

Or maybe It's possible to do rounding when reading the DB instead. So basically rounding on the database access layer. Values are stored faithfully, but "cleaned-up" on read.

Pros: it's easy because there is only one place to update in the code (database reading).
Cons: it's kind of a hack 😄


The main problem with doing it on the UI side of things, is that there are a lot of changes to do, potentially forgetting locations.

cogk avatar Apr 26 '24 10:04 cogk

how about when "Now" is pressed while manually adding an entry (and every where else) - keep seconds. If user sets hh:mm, then set seconds to 00? Would not require any re calculation of old entries, nor a complex logic. And old entries with seconds: it is what it is :)

precla avatar Apr 26 '24 10:04 precla

@cogk Wow, didn't think about rounding on database read. Seems like an interesting idea, will look into it!

Razeeman avatar Apr 26 '24 10:04 Razeeman