Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: New patch: autopreset of RTC after power-loss

Re: New patch: autopreset of RTC after power-loss

From: Björn Stenberg <bjorn_at_haxx.se>
Date: Fri, 7 Mar 2003 09:36:10 +0100

Michael Schopferer wrote:
> This patch checks the values of the RTC in settings_load in settings.c
> If they are out-of-range, the config_block is checked. If it is valid, these
> values are written to the RTC. If the block is invalid, the time and date
> are generated from APPSVERSION, the compile-time-value.

Sounds like an excellent approach.

> config_block[0xa1] = /* seconds */
> config_block[0xa2] = /* minutes */
> config_block[0xa3] = /* hour */
> config_block[0xa4] = /* dayofweek */
> config_block[0xa5] = /* day */
> config_block[0xa6] = /* month */
> config_block[0xa7] = /* year */

You should pack this a bit more. Day and month are both 4-bit values and could share a byte. Dayofweek is 3 bits while hour is 4 bits, so they could also share a byte.

> Now I'm working on a DaylightSavingTime-patch (DST).
> In the Time/Date-Setting toogles a PLAY-push between summertime/wintertime

I question the benefit of adding DST handling in Rockbox. If you need to toggle the bit manually, why not just change the hour field instead? Very very few devices bother with DST. Most digital clocks/watches, whose single purpose for existing is showing the time, don't even care about DST. Why then should we?

-- 
Björn
Received on 2003-03-07

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy