Michael D Schleif wrote:

> Consider this code:
> 
>     use POSIX qw(strftime);
>     print strftime("%a, %d %b %Y %H:%M:%S %z", localtime 1160662136), "\n";
> 
> On *NIX, that code produces this output:
> 
>     Thu, 12 Oct 2006 09:08:56 -0500
> 
> On Windows, using ActivePerl, I get this output on several boxes:
> 
>     Thu, 12 Oct 2006 09:08:56 Central Daylight Time
> 
> 
> I want the _numeric_ TZ reference.
> 
> I am NOT married to strftime.
> 
> What am I missing?

strftime imp. on Windoze:

%z, %Z Either the time-zone name or time zone abbreviation, depending on
   registry settings; no characters if time zone is unknown

What I would do is handle the TZ yourself :

use strict;
use warnings;
use POSIX qw(strftime);
use Time::Local;

my $offset = timegm (localtime) - time;
my $TZO  = sprintf "%+03d%02u", int ($offset / 3600), ($offset / 60) % 60;

print strftime ("%a, %d %b %Y %H:%M:%S $TZO", localtime 1160662136), "\n";

__END__

Result:
Thu, 12 Oct 2006 07:08:56 -0700

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

Reply via email to