joeycastillo / Sensor-Watch

A board replacement for the classic Casio F-91W wristwatch
Other
1.17k stars 234 forks source link

Add a manual DST toggle to settings #268

Closed harmonicoscillator closed 2 weeks ago

harmonicoscillator commented 1 year ago

Hi! I'm excited about receiving a sensorwatch lite soon, but noticed that there was no DST handling currently available in the settings.

My hope is that this makes it easier to keep faces like the sunrise/sunset accurate by updating both the hour and the timezone simultaneously, so you don't e.g. forget to update the timezone while editing the hour, leading to sunrises off by one hour.

Contents

This PR adds a very simplistic DST manual toggle by:

Potential side effects

Short of using the real tzinfo db, I don't think there's any sane way to automatically update the world clock settings, so I simply chose not to.

This addition shouldn't affect anyone who chooses not to use it (lucky folks without DST) other than an additional page in set_time_face.

Testing

I tested this out in the wasm emulator and things seemed to work OK.

Potential future work

I'd be interested in writing a future PR that adds datetime settings for when to automatically turn DST on and off, potentially using the RTC alarm callbacks.

Is there any chance at all that the actual tzinfo full db would fit in the firmware? If it's possible, then using linux-style timekeeping where the hardware RTC is always set to UTC and all time displays go through the tzinfo conversion would greatly simplify things like the world clock (where, since different regions do DST at different dates, it's pretty manual to know "what's the time in London?" when my local time is US EDT.)

matheusmoreira commented 7 months ago

Is there any chance at all that the actual tzinfo full db would fit in the firmware?

That'd be great indeed... The website says the full data distribution is about 440 KB but the microcontroller only has a maximum of 256 KB of flash. Perhaps there's a way to include only the data that the user is interested in.

harmonicoscillator commented 5 months ago

I've been running this since last October on my actual watch (red board) and used it successfully for the latest "spring forward" without any issues. Any hope this can get into mainline?

Is there any chance at all that the actual tzinfo full db would fit in the firmware?

That'd be great indeed... The website says the full data distribution is about 440 KB but the microcontroller only has a maximum of 256 KB of flash. Perhaps there's a way to include only the data that the user is interested in.

I did a little bit of digging and there are projects that compress the tzinfo db to be much smaller, generally by throwing away historical information. A couple examples I found were:

If one of those were incorporated into the SensorWatch build system I think we could get best-guess zone handling for future times. They're both quite old projects though, so would likely need some TLC.

voloved commented 4 weeks ago

Auto-DST PR created that branched off this PR. https://github.com/joeycastillo/Sensor-Watch/pull/470