Sobriety icon indicating copy to clipboard operation
Sobriety copied to clipboard

Bad time passed calculation when <24 hours

Open arajnoha opened this issue 1 year ago • 8 comments

Installed fresh version from F-DROID today. It seems that when I set a new addiction and mark a start time yesterday afternoon, it adds a day to the calculation.

It was 09:00 (9am) today (6th) and I set an addiction start to 23:20 (11:23pm) last night (5th). It showed me 1 day and 9 hours, as it would elapse another day since that.

a b

arajnoha avatar Mar 06 '23 09:03 arajnoha

Hmmm. There have been some bugs with the date picker in the past so this may just be a reoccurrence of that, which I know how to fix. I'll look into it!

KiARC avatar Mar 12 '23 09:03 KiARC

Sorry about that, I fixed this issue in the first commit of #96, but I can also separate it out into a different PR.

cubandle avatar Mar 13 '23 17:03 cubandle

Oh that's ok! I'll look over #96 when I get a chance to!

KiARC avatar Mar 13 '23 19:03 KiARC

I've noticed the same issue, though for me it persists for addiction created at any time. (limited testing, tried ~20 hours, ~2 days, ~1 week) they all seems to add exactly 1 day. I've also pretty much confirmed that it's not an issue with the date picker, as I exported data, and the epoch timestamps are all exactly as they should be. I poked around in your codebase briefly, but I'm not particularly familiar with Kotlin.

I would assume it's mostly with displaying, or perhaps an odd rounding error, but I have little proof of this

programing-monkey avatar Oct 14 '23 07:10 programing-monkey

@KiARC It seems the bug was fixed, so when the new release is planned? It's been more than a year since 10.0.0.

Rult avatar May 27 '24 19:05 Rult

I'm really sorry for not putting up 10.1.0 yet. The machine that had the signing keys died a while back and I still have not been able to recover them. The past several months have been swamped with schoolwork, but I finally might have a chance to figure this out. Again, I'm sorry for this getting delayed so much.

KiARC avatar May 27 '24 19:05 KiARC

The problem seems to be that it starts counting at midnight, rather than when hours is greater than 24. Same for when hours would tick up past 24, the day doesn't actually increment until midnight. I'm guessing it was using a built in function, and it counted days by date rather than by hour.

TreyCherry avatar Jul 19 '24 17:07 TreyCherry

As far as I'm aware, yes, that's what's happening

KiARC avatar Jul 19 '24 17:07 KiARC