[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stime.c forcing errno
From: |
Paul Jarc |
Subject: |
Re: stime.c forcing errno |
Date: |
Fri, 13 Feb 2004 22:52:34 -0500 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux) |
Kevin Ryde <address@hidden> wrote:
> I'm not sure what the standards say about these time functions setting
> errno.
<URL:http://www.opengroup.org/onlinepubs/007904975/functions/localtime.html>:
# If an error is detected, localtime() shall return a null pointer and
# set errno to indicate the error.
<URL:http://www.opengroup.org/onlinepubs/007904975/functions/gmtime.html>:
# If an error is detected, gmtime() shall return a null pointer and
# set errno to indicate the error.
<URL:http://www.opengroup.org/onlinepubs/007904975/functions/mktime.html>:
# No errors are defined.
<URL:http://www.opengroup.org/onlinepubs/007904975/functions/strptime.html>:
# No errors are defined.
<URL:http://www.opengroup.org/onlinepubs/007904975/functions/errno.html>:
# The value of errno shall be defined only after a call to a function
# for which it is explicitly stated to be set
So for localtime/gmtime, set errno beforehand just in case libc fails
to conform. But for mktime/strptime, test for failure afterwards and
set errno in that case. Setting it beforehand may not help; since
these functions are not documented to have any particular effect on
errno, they might have any effect at all - such as replacing our
EINVAL with something nonsensical.
paul