Timezones 
Author Message
 Timezones

I normally work with UNIX and can manipulate the output of localtime()
by setting $ENV{TZ}.  That doesn't seem to do anything useful on NT.

1) Is there any equivalent thing to do in NT?
2) Is there any easy way to tell what timezone I'm in (on either OS)?

I could send 0 into timelocal() and find the offset, but on UNIX there's
a name associated with it (like 'PDT' or 'US/Pacific').  /bin/date can
get it.  I truss()'d /bin/date and can see it opening the correct
zoneinfo file, but I don't understand how it finds the right one.  I can
read $ENV{TZ}, but it doesn't have to be set.  I'm not sure what to do
when it's null.

Thanks.
--

Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                               San Francisco Bay Area
      < Please move on, ...nothing to see here,  please disperse >



Mon, 10 Feb 2003 03:00:00 GMT  
 Timezones

: I normally work with UNIX and can manipulate the output of localtime()
: by setting $ENV{TZ}.  That doesn't seem to do anything useful on NT.

: 1) Is there any equivalent thing to do in NT?
: 2) Is there any easy way to tell what timezone I'm in (on either OS)?

On Windows (including NT) the control panel is used to set timezone
related parameters.

The values are stored in the registry.

(I don't know off hand which registry settings.)

Presuably you can get the settings using the win32 modules that read the
registry.



Tue, 11 Feb 2003 03:00:00 GMT  
 Timezones

Quote:
> On Windows (including NT) the control panel is used to set timezone
> related parameters.

Sure, but Apache has no problems with applying its own Unix-like rules
under MS Windows (for example honouring the shebang line for invoking
CGI scripts, to take just one off-topic but IMHO relevant example).

It would seem reasonable for Perl to honour the TZ setting itself,
when implementing localtime, if the OS doesn't want to play along, no?

Quote:
> Presuably you can get the settings using the win32 modules that read the
> registry.

But if you want to know what the answer to localtime() would be in
a timezone specified by you, then knowing what localtime() is in the
timezone known to the OS doesn't seem to help: you can already cut out
the middleman and request the gmtime(), if you're going to have to do
the computation yourself anyway.

all the best



Tue, 11 Feb 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Convert GMT to North American timezones

2. Timezones

3. Module for timezones

4. How to get times in different timezones?

5. parameterized query problems...

6. Turbo Pascal 7.0

 

 
Powered by phpBB® Forum Software