Rockbox Technical Forums

Rockbox Development => Feature Ideas => Topic started by: zaphee on March 29, 2009, 08:19:10 AM

Title: "Automatically adjust clock for daylight saving changes" option
Post by: zaphee on March 29, 2009, 08:19:10 AM
Hi.
This morning I saw that my nano didn't adjust clock for summer time.
I know that this option is useful only twice a year, but it would be nice that Rockbox could automatically adjust clock for summer time.
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: roolku on March 29, 2009, 03:12:48 PM
I concur. It is especially bad if you have several targets.

amiconn proposed a way to implement it the last time it happened, but I fear the idea has fallen by the wayside.
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: JdGordon on March 29, 2009, 10:57:09 PM
this come up twice a year and then dies very quickly :)

its easy to do, but its also easier to just change the clock than to code the patch and commit it :)
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: safetydan on March 29, 2009, 11:08:46 PM
The only way this could work is if you included a time zone database and a setting to set the user's current location. Then you'd have to ensure the time zone database is kept up to date with all the crazy changes that happen to time zone rules.
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: JdGordon on March 29, 2009, 11:14:34 PM
my feeling is that all it needs is a setting "winter time", "DST+1h", "DST+2h" which should cover everything and not need anything be kept up dated... but its hardly worth the effort
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: Llorean on March 30, 2009, 03:22:49 AM
Instead of including a time zone database, it seems like you could simply have two options, one of "DST begin date" and "DST end date." I don't know if internationally DST is always one hour, assuming it is, that's enough. If it's not, a third option "DST time offset" would handle the rest (or, to make the overall option more flexible, you could rename them so that a person could have their clock 'auto adjust' for a trip they're taking to a different time zone if they planned ahead).
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: Febs on March 30, 2009, 08:03:54 AM
Bear in mind that there are some places (Arizona, for example) that do not observe Daylight Savings Time, so there would need to be a setting to turn off DST adjustment entirely.
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: Genre9mp3 on March 30, 2009, 03:20:10 PM
Instead of including a time zone database, it seems like you could simply have two options, one of "DST begin date" and "DST end date."

That would be a bit pointless though because DST rules don't set specific dates but have rules like "Start: Last Sunday in March - End: Last Sunday in October". This would require the user to calculate the dates every year which would be far more complex than just adjusting the time manually.

I don't know if internationally DST is always one hour

It's indeed one hour for every country that uses the DST system.

I agree with what safetydan said. The only proper way to implement this would be to maintain an up-to-date database of DST rules worldwide and let the user choose his/her location.
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: JdGordon on March 30, 2009, 03:39:18 PM
It's indeed one hour for every country that uses the DST system.

not always... australia did 2 hours DST in 2000 for the olympics.... there is no 1 rule
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: Llorean on March 30, 2009, 04:09:47 PM
Keeping a database means we need to actually keep track of DST rule changes everywhere, as they happen. We'd also be the ones yelled at if an error in the database caused someone to miss work, no matter how many places we state there's no warranty.

The advantage of "dates" rather than manually setting is that you can prepare your player in advance, rather than forgetting and having to adjust it later (which can be important for features like an alarm you depend on to go to work/class).
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: safetydan on March 30, 2009, 04:47:28 PM
There are free databases of time zone data available. The one that most people use is the tzdata collection available from various places and used by almost all opensource systems (and a lot of closed source). So we don't have to maintain our own database, just provide an interface to select the appropriate region and then follow the rules in the database.
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: Hillshum on March 30, 2009, 06:56:53 PM
Have rbutil manage the database?
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: JdGordon on March 30, 2009, 07:02:09 PM
my feeling is that all it needs is a setting "winter time", "DST+1h", "DST+2h" which should cover everything and not need anything be kept up dated... but its hardly worth the effort

imo ^^ is the only workable solution that doesnt need massive updating...
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: soap on March 30, 2009, 11:26:27 PM
my feeling is that all it needs is a setting "winter time", "DST+1h", "DST+2h" which should cover everything and not need anything be kept up dated... but its hardly worth the effort

imo ^^ is the only workable solution that doesnt need massive updating...
+1 to a "standard" database file.  (said w/o knowing squat about the impact of this method).
As for the database file itself...
I smell a RBUtil job!  ;)
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: zaphee on April 03, 2009, 10:01:32 AM
my feeling is that all it needs is a setting "winter time", "DST+1h", "DST+2h" which should cover everything and not need anything be kept up dated... but its hardly worth the effort

imo ^^ is the only workable solution that doesnt need massive updating...
+1 to a "standard" database file.  (said w/o knowing squat about the impact of this method).
As for the database file itself...
I smell a RBUtil job!  ;)

+1
Isn't it simple to just implement a summer time sheduler, so that it just adds 1 hour when switching to the summer time, and substracts 1 hour for the winter time.
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: soap on April 03, 2009, 05:58:22 PM
Isn't it simple to just implement a summer time sheduler, so that it just adds 1 hour when switching to the summer time, and substracts 1 hour for the winter time.
When does summer time start and end?
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: JdGordon on April 03, 2009, 06:02:25 PM
we *could* put in a very system where the user can set it... but thats more work than its worth
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: Llorean on April 03, 2009, 06:28:53 PM
Haven't we established that we could just use an existing database?
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: JdGordon on April 03, 2009, 07:19:47 PM
no because we'd have to keep it updated
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: Chronon on April 03, 2009, 07:40:57 PM
A database like this (http://www.twinsun.com/tz/tz-link.htm)?
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: peter_s_d on June 15, 2009, 02:47:53 AM
You guys are making this far too complex.  (Worldwide databases of all timezones, northern and southern hemispheres accounting for ever changing local laws is very involved.) 

How about automatically syncing RockBox's clock to the computer's clock when you plug it in? 

If someone can't sort out their computer's clock they weren't going to get Rockbox's clock right anyway. 
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: Llorean on June 15, 2009, 02:51:23 AM
That requires something running on the PC-side to do the clock setting, and a player that can communicate with the host beyond basic UMS.

I don't really see how that's better than letting the player handle it on its own with a properly set up database, since it'd only be workable for a subset of players, and only if the computer owners ran (or kept running) a program designed to update the DAP's clock.
Title: Re: "Automatically adjust clock for daylight saving changes" option
Post by: rasher on June 17, 2009, 10:24:34 AM
Honestly I think this is far more work that it's worth. We'd have to track tzdata updates, and include it in every download. I don't know how much we could cut away (probably a good chunk), but the tzdata package on my Debian system is 6MB. For targets with software USB we could use the iPod's time syncing feature (http://www.rockbox.org/twiki/bin/view/Main/IpodItunesCommunication#Setting_the_clock), and hope someone would be willing to create a small utility to do this automatically.