Front page | perl.macperl.toolbox |
Postings from May 2003
Re: Timezone information
Thread Next
From:
Chris Nandor
Date:
May 6, 2003 04:44
Subject:
Re: Timezone information
Message ID:
pudge-F548E6.07445406052003@onion.valueclick.com
In article <BADC383D.47B%rickm@iSite.net.au>,
rickm@iSite.net.au (Rick Measham) wrote:
> I figure that as I've set my timezone in the system, there must be some way
> to get it back using MacPerl.
>
> I figure there's either an OSA hook that will tell me what it is, or there's
> a toolbox call that I can (somehow) make.
#!perl
use Time::Local;
$diff = (timelocal(localtime) - timelocal(gmtime)) / 36;
$diff = sprintf "%+0.4d", $diff; # add sign, leading zero(es)
print $diff;
That will give you the standard TZ offset (e.g., "-0400").
--
Chris Nandor pudge@pobox.com http://pudge.net/
Open Source Development Network pudge@osdn.com http://osdn.com/
Thread Next
-
Re: Timezone information
by Chris Nandor