Hi out there,

I'm having issues with retrieving the correct
time on my machine. In Germany it's now DST -
the windows shell shows correctly

  C:\>TIME /T
  15:18

But no way to retrieve the correct time
with PERL:

  C:\>perl -e "my $time = localtime; print $time;"
  Thu Mar 30 14:18:41 2006

  C:\>perl -e "my $time = gmtime; print $time;"
  Thu Mar 30 13:18:47 2006

  C:\>perl -e "use ActiveState::DateTime qw(gmt_offset); print gmt_offset();"
  0100

  C:\>perl -e "print( (localtime())[8] );"
  0

According to 'perlfunc':  "$isdst is true if the specified
time occurs during Daylight Saving Time, false otherwise."
So - according to my understanding - "(localtime())[8]"
should have retured "1".

I googled the web, searched CPAN and browsed thru
ActiveState docu - no real solution found so far.
The module "Win32::UTCFileTime" seems to be aware of
this problem but it deals with File times and I need
the system time.

The only 2 solutions I figured out so far:

1.) $time = `TIME /T`; chomp( $time);
2.) get time with "TIME /T", compare it with localtime,
    calculate offset, use offset for further time processing

Solution #1 has a perfomance penalty (lots of external command calls)
and #2 doesn't look very elegant...

Are there any commands/tools/modules in PERL 5.8 out there
which might do a better job ?

My PERL in use:

C:\>perl -v
This is perl, v5.8.7 built for MSWin32-x86-multi-thread
(with 14 registered patches, see perl -V for more detail)
Copyright 1987-2005, Larry Wall
Binary build 815 [211909] provided by ActiveState http://www.ActiveState.com
Built Nov  2 2005 08:44:52

Thanx for your help in advance

greetings from the polish border

Oliver

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to