Re: [NTLK] Updated daylight saving time algorithm.

From: Simon Bell <simonbell_at_mac.com>
Date: Tue Aug 01 2006 - 06:45:18 EDT

On 1 Aug, 2006, at 6:35 am, Andrei Chichak wrote:

> The US government has taken it upon themselves to change the dates
> for daylight saving time. The Canadian government, being great huge
> suckups, have decided to go along with the plan.
> <snip>
> it is up to us to adjust the Newtons.
>
> SO, first, I haven't been able to find the system soup entries that
> configure the DST rules. Does anyone know if there is a quick and
> dirty way of adjusting the DST rules?

I don’t think there’s a quick way, but it’s certainly going to be dirty.

The DST rules are held in a package store, ie read-only. You can see
the store in the popup list produced by ViewFrame when you do Get
Stores; it’s called "WorldData".

The OS’s DST functions access the soup they’re in by calling the
global function-
    GetLocationSoup("DaylightSavings");

Each entry in the soup is a DST rule-
{
    symbol: 'northAmerica,
    name: "North American",
    start: { month: 4, ordinal: 1, dayOfWeek: 0, time: 120 },
    stop: { month: 10, ordinal: 5, dayOfWeek: 0, time: 120 },
    change: 60
}

You can pretty easily work out what each slot means-
   from [start] first [ordinal=1] Sunday [dayOfWeek=0] in April
[month=4] at 2am [time=120]
    to [stop] last [ordinal=5] Sunday [dayOfWeek=0] in October
[month=10] at 2am [time=120]
   adjust time by +1 hour [change=60]

The problem is how you override the read-only soup entry.

Simon

-- 
This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
Official Newton FAQ: http://www.chuma.org/newton/faq/
WikiWikiNewt for all kinds of articles: http://tools.unna.org/wikiwikinewt/
Received on Tue Aug 1 06:45:25 2006

This archive was generated by hypermail 2.1.8 : Tue Aug 01 2006 - 08:30:00 EDT