Daylight Savings Time

Richard Miller wow at together.net
Mon Oct 27 15:25:31 EDT 2008


This seems to work for determining if daylight savings time is in  
effect on a given computer. Would this be reliable?

put false into DST
put the short time into x
convert x to seconds
convert x to short time
if x <> the short time then put true into DST

Thanks.
Richard


On Oct 27, 2008, at 7:33 AM, Richard Miller wrote:

> Thanks, Sarah. I'm not thrilled about this solution (as you don't  
> seem to be either), but perhaps it's the best there is. Anyone know  
> how to get this "time zone data" from a PC?
>
> Richard
>
>
>
> On Oct 26, 2008, at 6:19 PM, Sarah Reichelt wrote:
>
>> 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