delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/05/15/14:40:20

X-Spam-Check-By: sourceware.org
Message-ID: <4468CADE.7090407@t-online.de>
Date: Mon, 15 May 2006 20:39:26 +0200
From: Christian Franke <Christian DOT Franke AT t-online DOT de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060130 SeaMonkey/1.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Python 2.4.1-1 time.altzone does not include DST offset
References: <44671C44 DOT 7050309 AT t-online DOT de>
In-Reply-To: <44671C44.7050309@t-online.de>
X-ID: ZwHQJwZBQerfiPVb6pvzHf5ytQZPqUF7zCfCXRd066zOZPK25dUHZC
X-TOI-MSGID: 2e339b49-b596-4af5-a1e7-4738ceda933e
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------040509080605040605050401
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit


> Python's time.altzone is equal to time.timezone, it should be 
> time.timezone-3600 (for CEST)
>
> $ python -c 'import time; time.tzset(); print time.ctime(), \
>  time.daylight, time.timezone, time.altzone, time.tzname'
> Sun May 14 13:46:55 2006 1 -3600 -3600 ('   ', '   ')

On Cygwin, time.altzone is always set equal to time.timezone.

The attached patch should fix this for most timezones.
The function already uses the same heuristics in the !__CYGWIN__ &&
!HAVE_STRUCT_TM_TM_ZONE case.

Christian


--------------040509080605040605050401
Content-Type: text/plain;
 name="python-altzone-patch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="python-altzone-patch.txt"

diff -r -U 6 -p python-2.4.1-1.orig/Modules/timemodule.c python-2.4.1-1/Modules/timemodule.c
--- python-2.4.1-1.orig/Modules/timemodule.c	2004-08-03 19:58:55.001000000 +0200
+++ python-2.4.1-1/Modules/timemodule.c	2006-05-15 16:53:55.171875000 +0200
@@ -697,13 +697,13 @@ void inittimezone(PyObject *m) {
 	}
 #else
 #endif /* HAVE_STRUCT_TM_TM_ZONE */
 #ifdef __CYGWIN__
 	tzset();
 	PyModule_AddIntConstant(m, "timezone", _timezone);
-	PyModule_AddIntConstant(m, "altzone", _timezone);
+	PyModule_AddIntConstant(m, "altzone", _timezone-3600);
 	PyModule_AddIntConstant(m, "daylight", _daylight);
 	PyModule_AddObject(m, "tzname",
 			   Py_BuildValue("(zz)", _tzname[0], _tzname[1]));
 #endif /* __CYGWIN__ */
 #endif /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/
 }


--------------040509080605040605050401
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
--------------040509080605040605050401--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019