[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Q on Mac Time Zones



This won't work in Europe and Asia where localtime>gmtime?

Anywhere east of Greenwich will return a negative value rather than a
positive one.

Chris

> At 01.02 -0500 1999.01.08, Walter Torres wrote:
> >Any one have any idea on how to get the Time Zone setting out of the Mac?
> 
> Untested in other places, but should work anywhere, I think:
> 
>   #!perl
>   use Time::Local;
>   $diff = (timelocal(localtime) - timelocal(gmtime)) / 36;
>   $diff =~ s/^-?(\d{3})$/-0$1/;  # add leading zero if only three digits
>   print $diff;
> 
> On my Mac, $diff is -0500 (which is correct for the East Coast this time of
> year).
> 


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch