Re: Y2K38 bug (January 19, 2038)

Liste des GroupesRevenir à cl awk 
Sujet : Re: Y2K38 bug (January 19, 2038)
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.awk
Date : 13. Mar 2024, 17:30:32
Autres entêtes
Organisation : None to speak of
Message-ID : <87ttla5c2f.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Geoff Clare <geoff@clare.See-My-Signature.invalid> writes:
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.

That's likely to be the behavior for older implementations.  C11 isn't
quite as explicit, but it does say:

    On successful completion, the values of the tm_wday and tm_yday
    components of the structure are set appropriately, and the other
    components are set to represent the specified calendar time, but
    with their values forced to the ranges indicated above; the final
    value of tm_mday is not set until tm_mon and tm_year are determined.

I think it's reasonable to assume that tm_wday and tm_yday are not
modified unless the function is successful.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Date Sujet#  Auteur
8 Mar 24 * Re: Y2K38 bug (January 19, 2038)10Keith Thompson
11 Mar 24 +- Re: Y2K38 bug (January 19, 2038)1Geoff Clare
11 Mar 24 `* Re: Y2K38 bug (January 19, 2038)8Mr. Man-wai Chang
11 Mar 24  `* Re: Y2K38 bug (January 19, 2038)7Keith Thompson
12 Mar 24   `* Re: Y2K38 bug (January 19, 2038)6Geoff Clare
12 Mar 24    +* Re: Y2K38 bug (January 19, 2038)4Christian Weisgerber
13 Mar 24    i`* Re: Y2K38 bug (January 19, 2038)3Keith Thompson
13 Mar 24    i `* Re: Y2K38 bug (January 19, 2038)2Geoff Clare
13 Mar 24    i  `- Re: Y2K38 bug (January 19, 2038)1Keith Thompson
13 Mar 24    `- Re: Y2K38 bug (January 19, 2038)1Keith Thompson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal