Daylight Saving Time

Sarah Reichelt sarah.reichelt at gmail.com
Sun Oct 26 18:19:51 EDT 2008


On Mon, Oct 27, 2008 at 7:59 AM, Richard Miller <wow at together.net> wrote:
> Is there a simple way to know whether DST is in effect in a particular
> location? Would it make sense, for example, to compare "the short time" with
> the local time as accessed through some web site? If they're not the same,
> assume DST is in effect? If so, any ideas for a web site to access for the
> current time?

The only way I found to do this was to get the AppleScript time zone
data and the Rev time zone data and work out the number of seconds
difference between the two. Here is my function for getting the
current number of seconds of daylight savings time:

function DSTseconds
    put the internet date into tNow
    put last word of tNow into tZone
    replace "+" with empty in tZone
    put char -2 to -1 of tZone into tMins
    delete char -2 to -1 of tZone
    add tMins / 60 to tZone
    put "tell application " & quote & "Finder" & quote & "" & cr \
            & "return time to GMT" & cr & "end tell" into tScript
    do tScript as AppleScript
    put the result / 3600 into tDiff
    put (tDiff - tZone) * 3600 into tDST

    return tDST
end DSTseconds

e.g. where I am in Queensland, Australia, we have no daylight savings
so this returns 0.
If I set my location to Sydney which has 1 hour of daylight savings at
this time of year, I get 3600.

Of course this is a Mac only solution and it only works for the time &
location settings of the computer where the app is running, you cannot
feed it the name of a city and ask for the data.

Cheers,
Sarah



More information about the use-livecode mailing list