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

Re: [MacPerl] Q on Mac Time Zones



Chris Nandor wrote:
> 
> At 09.51 -0500 1999.01.08, Christopher F. Blanford wrote:
> >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.
> 
> Oh, my regex is bad.
> 
> Something like this seems to work:
> 
>     $diff =~ s/^(-?)(\d{3,4})$/
>         ($1 ? '-' : '+') .
>         (length($2) == 3 ? "0$2" : $2)/e;
> 

Closer, but you're still missing GMT: '+0000', not '+0'.  That's what you
get for trying to use regex substitution to pad numbers.  It's ugly for
dates, it's even uglier for timezone offsets.

Hopefully my sprintf solution will have propagated to the list by now.

Ronald

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