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: Clarify mktime semantics
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jhylton Nosy List: blais, erl, jhylton, tim.peters
Priority: normal Keywords:

Created on 2003-03-05 13:46 by erl, last changed 2022-04-10 16:07 by admin. This issue is now closed.

Messages (5)
msg14976 - (view) Author: Erland Lewin (erl) Date: 2003-03-05 13:46
Python Library Reference, Chapter 6.9

mktime: I believe the C mktime calls ignore the weekday
and Julian day values in the tuple. I therefor assume
that the Python function also does so, which should be
documented.
msg14977 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2003-03-05 19:05
Logged In: YES 
user_id=31435

Python does (for the most part) inherit mktime semantics 
from the platform C, but mktime() is "underspecified" by 
ANSI C and there's little that can be said about oddball 
cases across platforms.  Sometimes it even depends on 
the preprocessor symbols defined when the platform C 
library was compiled.
msg14978 - (view) Author: Erland Lewin (erl) Date: 2003-03-06 15:44
Logged In: YES 
user_id=116933

I have a draft of the C99 standard, which in paragraph
7.23.2.3 describes mktime, and says:

"The original values of the tm_wday and tm_yday components
of the structure are ignored..."

So, I would say that mktime() is *not* underspecified by ISO C.

In order to write correct programs, it is neccessary to know
the semantics of the functions, and IMHO the manual should
specify what can be expected of them.
msg14979 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2003-03-06 19:01
Logged In: YES 
user_id=31435

Yup, I agree the spec is clear on this specific point.  I'd rather 
the docs refer users to the platform C docs, though, as many 
other aspects of mktime can and do vary across 
implementations (for example, C is silent on the origin of the 
epoch, while POSIX defines it; C and POSIX are both clear as 
mud about how out-of-range struct tm members are to be 
treated; etc -- google for mktime man pages to see what a 
mess this function really is across platforms).
msg14980 - (view) Author: Martin Blais (blais) * (Python committer) Date: 2007-05-28 02:33
This is somewhat related to this bug/patch:
http://sourceforge.net/tracker/index.php?func=detail&aid=1726687&group_id=5470&atid=105470
History
Date User Action Args
2022-04-10 16:07:23adminsetgithub: 38106
2003-03-05 13:46:37erlcreate