On Thursday, September 4, 2003, at 09:37 PM, Dave Rolsky wrote:

I'm pretty sure you have to do that.  For example, if you simply set
$ENV{TZ} then localtime() doesn't change in this script:

perl -le 'print scalar localtime; $ENV{TZ} = "Asia/Tokyo"; print scalar localtime'

But in this one it does

perl -MPOSIX -le 'print scalar localtime; $ENV{TZ} = "Asia/Tokyo"; POSIX::tzset(); print scalar localtime'

Damn, okay, thanks.


Can you do another test for me (since I don't have a platform that needs tzset)? Can you tell me how it affects use of local? Here's a test script:

#!/usr/bin/perl -w
use strict;
use POSIX qw(tzset);

print scalar localtime, $/;
{
    local $ENV{TZ} = "Asia/Tokyo";
    tzset;
    print scalar localtime, $/;
}
print scalar localtime, $/;

The question is, what does the third print statement print? Do I need to call tzset again after the block?

TIA,

David

--
David Wheeler                                     AIM: dwTheory
[EMAIL PROTECTED]                              ICQ: 15726394
http://www.kineticode.com/                     Yahoo!: dew7e
                                               Jabber: [EMAIL PROTECTED]
Kineticode. Setting knowledge in motion.[sm]



Reply via email to