Deutsch English Français Italiano |
<man8ck-pdr.ln1@ID-313840.user.individual.net> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Geoff Clare <geoff@clare.See-My-Signature.invalid> Newsgroups: comp.lang.awk Subject: Re: Y2K38 bug (January 19, 2038) Date: Wed, 13 Mar 2024 13:46:30 +0000 Lines: 30 Message-ID: <man8ck-pdr.ln1@ID-313840.user.individual.net> References: <b2321bbf-e9a1-40d5-9261-db53a98a8dadn@googlegroups.com> <o29c2k-0a9.ln1@ID-313840.user.individual.net> <874jdgwlhh.fsf@nosuchdomain.example.com> <usng5u$3o4es$3@toylet.eternal-september.org> <87edcga9yu.fsf@nosuchdomain.example.com> <j726ck-3qt.ln1@ID-313840.user.individual.net> <slrnuv0qro.1gte.naddy@lorvorc.mips.inka.de> <87wmq76mra.fsf@nosuchdomain.example.com> Reply-To: netnews@gclare.org.uk Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net IRW6VLJkBJtduP4q33cj4gCkuKbtA3ezOtwRLirKxiPxxsy2yV X-Orig-Path: ID-313840.user.individual.net!not-for-mail Cancel-Lock: sha1:2XSyJ7L+SeNxE6BZEZO4QSZ9qaQ= sha256:FMkUKBrOe6sV6P0B7qBmUS6NQQJ+XZm/QO/btG03DI8= User-Agent: Pan/0.154 (Izium; 517acf4) Bytes: 2322 Keith Thompson wrote: > Christian Weisgerber <naddy@mips.inka.de> writes: >> On 2024-03-12, Geoff Clare <geoff@clare.See-My-Signature.invalid> wrote: >>> Also, having signed time_t doesn't necessarily mean that dates before >>> Jan 1970 are supported. >> >> mktime(3) is documented to return (time_t)-1 in case of error, which >> bodes ill for Dec 31, 1969, 23:59:59 UTC. > > It can still return a correct value of -1. It does make it difficult > for the caller to determine whether a -1 return value denotes an error > or not. C23 has introduced a way to distinguish the cases. It says: [on error] the function returns the value (time_t)(-1) and does not change the value of the tm_wday component of the structure. This will also be in the forthcoming POSIX.1 revision, which adds this advice: Since (time_t)−1 is a valid return value for a successful call to mktime(), an application wishing to check for error situations should set tm_wday to a value less than 0 or greater than 6 before calling mktime(). On return, if tm_wday has not changed an error has occurred. -- Geoff Clare <netnews@gclare.org.uk>