From: Vincent Lefevre <vincent@vinc17.net>
To: Xi Ruoyao <xry111@xry111.site>
Cc: Alejandro Colomar <alx@kernel.org>,
Paul Eggert <eggert@cs.ucla.edu>,
libc-alpha@sourceware.org, DJ Delorie <dj@redhat.com>,
linux-man@vger.kernel.org, carlos@redhat.com
Subject: Re: [PATCH v3] ctime.3: EXAMPLES: Add example program
Date: Fri, 23 Aug 2024 09:57:30 +0200 [thread overview]
Message-ID: <20240823075730.GG2981@qaa.vinc17.org> (raw)
In-Reply-To: <7be010d1eb77d72caef1ff7018213f94e0074714.camel@xry111.site>
On 2024-08-23 15:26:04 +0800, Xi Ruoyao wrote:
> On Fri, 2024-08-23 at 09:02 +0200, Alejandro Colomar wrote:
> > Is mktime(3) allowed to return -1 and set EOVERFLOW on a successful
> > call?
> >
> > RETURN VALUE
> > The mktime() function shall return the specified time since the
> > Epoch encoded as a value of type time_t. If the time since the
> > Epoch cannot be represented, the function shall return the value
> > (time_t)-1 and set errno to indicate the error.
>
> For mktime the standard only says "return (time_t)-1." It does not
> mention errno at all. And the standard also says:
>
> The value of errno may be set to nonzero by a library function call
> whether or not there is an error, provided the use of errno is not
> documented in the description of the function in this document.
>
> > Then I think the API is completely broken. How should we check for
> > errors after a mktime(3) call?
>
> Maybe, special case if tm contains Dec 31 1969 23:59:59 UTC... But it's
> just stupid.
>
> > If this is so, let me file a glibc bug requesting a fix of the API,
> > adding a promise that on success, errno will remain unset.
>
> It's a bug in the standard, not glibc. And the standard has deprecated
> it anyway.
>
> https://www.open-std.org/JTC1/SC22/WG14/www/docs/n2566.pdf
I can see only asctime and ctime mentioned there, not mktime.
So mktime isn't deprecated, is it?
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
next prev parent reply other threads:[~2024-08-23 8:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 23:11 [PATCH v4] ctime.3: Document how to detect invalid or ambiguous times Alejandro Colomar
[not found] ` <xned6jlywd.fsf@greed.delorie.com>
2024-08-22 23:49 ` [PATCH v3] ctime.3: EXAMPLES: Add example program Alejandro Colomar
2024-08-23 4:57 ` Paul Eggert
2024-08-23 7:02 ` Alejandro Colomar
2024-08-23 7:26 ` Xi Ruoyao
2024-08-23 7:57 ` Vincent Lefevre [this message]
2024-08-23 12:28 ` Alejandro Colomar
2024-08-23 12:28 ` Xi Ruoyao
2024-08-23 12:53 ` Vincent Lefevre
2024-08-23 13:12 ` Alejandro Colomar
2024-08-23 13:54 ` Vincent Lefevre
2024-08-23 14:18 ` Alejandro Colomar
2024-08-23 15:26 ` Vincent Lefevre
2024-08-23 17:48 ` Alejandro Colomar
2024-08-23 18:46 ` Robert Elz
2024-08-23 19:08 ` Paul Eggert
2024-08-23 20:09 ` Hans Åberg
2024-08-23 20:34 ` Alejandro Colomar
2024-08-23 14:04 ` Brian Inglis
2024-08-23 14:25 ` Alejandro Colomar
2024-08-23 18:31 ` Brian Inglis
2024-08-23 20:27 ` Alejandro Colomar
2024-08-24 8:46 ` [PATCH v5] ctime.3: Document how to detect invalid or ambiguous times Alejandro Colomar
2024-08-25 18:33 ` Alejandro Colomar
2024-08-30 11:09 ` [PATCH v6] ctime.3: EXAMPLES: " Alejandro Colomar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240823075730.GG2981@qaa.vinc17.org \
--to=vincent@vinc17.net \
--cc=alx@kernel.org \
--cc=carlos@redhat.com \
--cc=dj@redhat.com \
--cc=eggert@cs.ucla.edu \
--cc=libc-alpha@sourceware.org \
--cc=linux-man@vger.kernel.org \
--cc=xry111@xry111.site \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox