Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify mktime semantics #38106

Closed
erl mannequin opened this issue Mar 5, 2003 · 5 comments
Closed

Clarify mktime semantics #38106

erl mannequin opened this issue Mar 5, 2003 · 5 comments
Labels
docs Documentation in the Doc dir

Comments

@erl
Copy link
Mannequin

erl mannequin commented Mar 5, 2003

BPO 697989
Nosy @tim-one

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2007-05-28.02:33:04.000>
created_at = <Date 2003-03-05.13:46:37.000>
labels = ['docs']
title = 'Clarify mktime semantics'
updated_at = <Date 2007-05-28.02:33:04.000>
user = 'https://bugs.python.org/erl'

bugs.python.org fields:

activity = <Date 2007-05-28.02:33:04.000>
actor = 'blais'
assignee = 'jhylton'
closed = True
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2003-03-05.13:46:37.000>
creator = 'erl'
dependencies = []
files = []
hgrepos = []
issue_num = 697989
keywords = []
message_count = 5.0
messages = ['14976', '14977', '14978', '14979', '14980']
nosy_count = 4.0
nosy_names = ['tim.peters', 'jhylton', 'erl', 'blais']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue697989'
versions = []

@erl
Copy link
Mannequin Author

erl mannequin commented Mar 5, 2003

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.

@erl erl mannequin closed this as completed Mar 5, 2003
@erl erl mannequin assigned jhylton Mar 5, 2003
@erl erl mannequin added the docs Documentation in the Doc dir label Mar 5, 2003
@erl erl mannequin closed this as completed Mar 5, 2003
@erl erl mannequin assigned jhylton Mar 5, 2003
@erl erl mannequin added the docs Documentation in the Doc dir label Mar 5, 2003
@tim-one
Copy link
Member

tim-one commented Mar 5, 2003

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.

@erl
Copy link
Mannequin Author

erl mannequin commented Mar 6, 2003

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.

@tim-one
Copy link
Member

tim-one commented Mar 6, 2003

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).

@blais
Copy link
Mannequin

blais mannequin commented May 28, 2007

This is somewhat related to this bug/patch:
http://sourceforge.net/tracker/index.php?func=detail&aid=1726687&group_id=5470&atid=105470

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

1 participant