This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: time.tzset() not built on Solaris
Type: Stage:
Components: Build Versions: Python 2.4
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, gnbond
Priority: normal Keywords: patch

Created on 2005-01-05 05:26 by gnbond, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ci.diffs gnbond, 2005-01-07 00:56 Diffs to configure.in
ci.diffs2 gnbond, 2005-01-07 01:44 More comprehensive diffs
Messages (6)
msg47473 - (view) Author: Gregory Bond (gnbond) Date: 2005-01-05 05:26
The time.tzset() function is not included in Solaris
builds, because the code in configure.in that checks
for the existence of tzset() relies on struct tm having
a tm_zone member - which Solaris does not have (at
least not up to 2.8).

The attached patch to configure.in allows Solaris to
detect the existence of tzset() and Python builds OK,
and the resulting time.tzset() function seems to work
just fine.

diff -u configure.in.DIST configure.in
--- configure.in.DIST   2005-01-05 16:25:24.830001000 +1100
+++ configure.in        2005-01-05 16:25:38.227000000 +1100
@@ -2912,10 +2912,6 @@
        tzset();
        if (localtime(&groundhogday)->tm_hour != 11)
            exit(1);
-       if (strcmp(localtime(&groundhogday)->tm_zone,
"AEDT"))
-           exit(1);
-       if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
-           exit(1);
 
        exit(0);
 }
msg47474 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2005-01-06 07:26
Logged In: YES 
user_id=357491

But that fix removes a sanity check to detect broken tzset 
implementations.

Is there a similar way to check on Solaris to make sure tzset is not 
broken?  If so resubmit a patch (I reclassified this tracker item 
appropriately) that makes the test conditional on Solaris. 
msg47475 - (view) Author: Gregory Bond (gnbond) Date: 2005-01-07 00:56
Logged In: YES 
user_id=293157

Hmm, I'm no autoconf guru, but try the attached patch.  It
seems to do the right thing on Solaris (tzset but no
tm_zone) and FreeBSD (tzset and tm_zone).

Amazing what you can find with half an hour of Google!
msg47476 - (view) Author: Gregory Bond (gnbond) Date: 2005-01-07 01:44
Logged In: YES 
user_id=293157

I've added  second patch with more comprehensive diffs that
also checks whether tzset() affects tzname[] (for those
systems without tm_zone).  This may be considered overkill!
msg47477 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2005-01-07 03:57
Logged In: YES 
user_id=357491

Well, considering tzset can be called when HAVE_TZNAME is set it 
definitely does not hurt to check it.

The patch basically looks good, but I don't have time right now for a 
thorough check so I am not going to check it in right away.  But it will 
get in.
msg47478 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2005-02-10 22:47
Logged In: YES 
user_id=357491

For configure.in, rev. 1.481 in 2.5 and rev. 1.475.2.6 in 2.4 have the fix.  
Only modified the comments of your patch.

Thanks, Gregory!
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41401
2005-01-05 05:26:56gnbondcreate