[Python-Dev] tzset

Stuart Bishop zen@shangri-la.dropbear.id.au
Sat, 15 Mar 2003 17:34:26 +1100

On Saturday, March 15, 2003, at 02:00  PM, Tim Peters wrote:

> We seem to have added tzset() gimmicks to CVS Python.

That was my patch.

> test_time now fails on Windows, simply because time.tzset raises
> AttributeError there.

test_time.test_tzset should only be run if time.tzset is defined
(which should only be there if configure determines that tzset works
with the TZ formats we are testing). Feel like adding a clause at the
top of test_tzset to skip the test if time.tzset is not defined, or
should I submit a patch?

> Now Windows does support tzset(), but not TZ values of the form
> test_time.test_tzset() is testing, like
>                 environ['TZ'] = 'US/Eastern'
> and
>             environ['TZ'] = 'Australia/Melbourne'
> The rub here is that I haven't found *any* tzset man pages on the web 
> that
> claim TZ accepts such values (other than to silently ignore them 
> because

It specifies the pathname to a tzfile(5) format file, relative to
a OS defined default. From BSD:
     If its value does not begin with a colon, it is first used as the 
     name of a file (as described above) from which to read the time 
     sion information.  If that file cannot be read, the value is then 
     preted as a direct specification (the format is described below) of 
     time conversion information.
Solaris has a similar definition. Linux documents this format as 
needing to
start with a ':' but accepts it (at least I think I tested this...)

To me, this is the useful format as all the others require you to
know your DST transition times rather rely of the OS to supply them.
At the moment if the 'path to a tzfile(5)' format is not accepted, your
tzset(3) is considered broken and time.tzset not built.

I'm happy to rewrite the detection in configure.in and the test in
test_time.py to lower the bar on this, but I think a better solution
may be to determine if Windows has a format that lets us to DST
calculations and keep the bar high. I was hoping that such a format
would a) exist and b) Allow translation between the Unix standard of
Country/Region to whatever-windows-uses.

> not-all-pits-should-be-dived-into-ly y'rs  - tim

but-i-was-pushed-by-those-damn-politicans-ly y'rs

Stuart Bishop <zen@shangri-la.dropbear.id.au>