[Python-bugs-list] [ python-Bugs-404240 ] time_t can be unsigned
nobody
nobody@sourceforge.net
Wed, 28 Feb 2001 22:37:08 -0800
Bugs #404240, was updated on 2001-02-25 23:23
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=404240&group_id=5470
Category: Python Interpreter Core
Group: Platform-specific
Status: Closed
Priority: 5
Submitted By: Uwe Zessin
Assigned to: Fred L. Drake, Jr.
Summary: time_t can be unsigned
Initial Comment:
On recent versions of OpenVMS, time_t is defined as:
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]TIME.H;1
typedef unsigned long int time_t;
The compiler's complaint is as follows:
if (mtime == -1)
............^
%CC-I-QUESTCOMPARE1, In this statement, the unsigned
expression "mtime" is being compared with an equality
operator to a constant whose value is negative. This
might not be what you intended.
at line number 715 in file IMPORT.C
>>> import time
>>> time.ctime(0x7fffffff)
'Tue Jan 19 03:14:07 2038'
>>> time.ctime(0x80000000)
'Tue Jan 19 03:14:08 2038'
>>> time.ctime(0xfffffffe)
'Sun Feb 7 06:28:14 2106'
>>> time.ctime(0xffffffff)
'Sun Feb 7 06:28:15 2106'
>>>
----------------------------------------------------------------------
Comment By: Fred L. Drake, Jr.
Date: 2001-02-28 22:37
Message:
Logged In: YES
user_id=3066
Fixed in Python/import.c revision 2.168.
The second area you point out has having possible signedness assumptions regarding time_t actually does not: since the only values a time_t will have at that point are positive (regardless of signedness), the test only determines whether or not the value fits in 4 bytes.
Thanks!
----------------------------------------------------------------------
Comment By: Uwe Zessin
Date: 2001-02-28 22:17
Message:
Logged In: YES
user_id=155755
According to:
http://www.openvms.compaq.com/commercial/c/5763p048.htm#inde
x_x_1396
It uses '(time_t)(-1)'.
I have done a little bit more research and found out that
this is already used in TIMEMODULE.C at line 507:
'if (tt == ((time_t)(-1)) {'
Other manuals are at:
http://www.openvms.compaq.com/commercial/c/index_alpha.htm
It is possible that there is more code that assumes that
a time_t is always a signed type - see the #if block just
below line 715 in IMPORT.C.
(I'm currently holding a training and I will be going
abroad for some days - if you don't hear from me for
some time, please understand that it's not that I have
lost interest, OK? I try to check my mailbox from time
to time...)
----------------------------------------------------------------------
Comment By: Fred L. Drake, Jr.
Date: 2001-02-28 12:16
Message:
Logged In: YES
user_id=3066
What does OpenVMS use for an "invalid" value for the time_t type? Where can we find more specific information about this issue for OpenVMS?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=404240&group_id=5470