in reply to Re: setting timezone in windows
in thread setting timezone in windows

Me again, now logged (I was in other machine and I din't remember my passwd).

What I have finally do was to override the localtime method so it honors the TZ env variable.

package myModule::Localtime; use strict; require Exporter; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @EXPORT = qw(localtime timelocal); sub localtime{ my $time = defined $_[0] ? shift : time(); return CORE::localtime($time) if $^O ne 'MSWin32'; my $offset = 0; if(defined $ENV{TZ}){ $offset = (split /\s+/,$ENV{TZ})[1] || 0; } return gmtime($time - ($offset*60*60) ); }
Then in my script I use:
use myModule::Localtime; $ENV{TZ}="GMT -2"; print "localtime -2:".localtime($time).$/;
and woks fine.

The only promblem is that it don't recognizes timezones like America/Argentina/Buenos_Aires. Timzeones has to be acoording \w+\s+\d+, but this could be fixed easily.

Thanks a lot for yours answers.
Nicolás.