At 11:56 -0800 2001.11.21, John W Baxter wrote: >At 8:26 -0500 11/21/2001, Chris Nandor wrote: >>At 14:19 +0100 2001.11.21, Louis Pouzin wrote: >>>The Mac Date & Time control panel keeps the time zone. e.g. Paris. >>> >>>Is there a way to grab this info, in MacPerl, or at least the difference >>>from >>>UTC ? >> >> use Time::Local; >> $diff = (timelocal(localtime) - timelocal(gmtime)) / 36; >> $diff = sprintf "%+0.4d", $diff; # add sign, leading zero(es) >> print $diff; > >Code assumes "well-behaved" time zones. Not all areas have local time >which is some multiple of 3600 seconds away from UTC (I don't off hand know >of any areas which aren't some multiple of 900 seconds from UTC).
No, it should work for any time zone. Kabul, Afghanistan: +0450 Boston, U.S.A. : -0500 -- Chris Nandor [EMAIL PROTECTED] http://pudge.net/ Open Source Development Network [EMAIL PROTECTED] http://osdn.com/