j4velin / Pedometer

Lightweight pedometer app for Android using the hardware step sensor
https://play.google.com/store/apps/details?id=de.j4velin.pedometer
Apache License 2.0
1.44k stars 672 forks source link

Data will be deleted on time zone change #89

Open sedrubal opened 8 years ago

sedrubal commented 8 years ago

When you travel around the world and your time zone changes, pedometer will delete all data and start from scratch.

liu402883451 commented 7 years ago

how can I solve it ?

Dannysw commented 7 years ago

I have it acting slightly differently. It just seems to reset the current date, then the next day goes huge. I can have a look at it once I stop travelling.

scrunchy commented 7 years ago

I've just had this happen when I've traveled between timezones last week - each timezone change threw out the pedometer count for a day or so each side of the time the timezone change occurred. It doesn't correct when you change back to the original timezone in my experience.

miiichael commented 6 years ago

I am also experienced this bug.

screenshot_2018-01-27-01-27-11

I was airborne while crossing midnight, leaving UTC+08 and arriving in UTC+11.

miiichael commented 6 years ago

Huh, even weirder, my Wednesday stats have now disappeared altogether. screenshot_2018-01-27-01-54-25

puddly commented 4 years ago

I think this problem might be caused by storing only daily counts, but with "today" depending on the local time zone. When you change timezones, "today" changes and weird things happen.

One possible solution is to instead store step counts every 15 minutes, to account for every possible time zone offset. That way, you can always compute the "daily" step count based on the user's current timezone without making the database dependent on it. The DB size will grow much faster, but you'd still need to walk nonstop for 30 years before it hits a million rows.

Your displayed step counts would change if you travel between timezones, but that's something that can be worked around if you also store the current timezone in the database for each row.

@j4velin what do you think?