• Y2K38 bug (January 19, 2038)

    From J Naman@21:1/5 to All on Mon Nov 13 10:02:52 2023
    Is there any plan or schedule for POSIX to replace the Unix 32-bit time by a 64-bit time format to avoid the Y2K38 bug ( January 19, 2038, at 03:14:07 UTC.)? I am really asking if GNU awk or other awks expect to upgrade before or after the next revision
    of POSIX in 2026? Is there any certainty that POSIX WILL revise time in 2026? I keep running into Y2K38 issues with some US government data. mktime() is no big deal to handle at the user level, but strftime() IS a (the) real problem.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Geoff Clare@21:1/5 to J Naman on Tue Nov 14 13:25:12 2023
    J Naman wrote:

    Is there any plan or schedule for POSIX to replace the Unix 32-bit
    time by a 64-bit time format to avoid the Y2K38 bug ( January 19,
    2038, at 03:14:07 UTC.)? I am really asking if GNU awk or other awks
    expect to upgrade before or after the next revision of POSIX in 2026?
    Is there any certainty that POSIX WILL revise time in 2026? keep
    running into Y2K38 issues with some US government data. mktime() is
    no big deal to handle at the user level, but strftime() IS a (the)
    real problem.

    The current draft of the next POSIX revision has this in the
    description of the <sys/types.h> header:

    time_t shall be an integer type with a width (see <stdint.h>) of
    at least 64 bits.

    The revision is expected to be approved next year.

    So awk (and other) utilities that are compiled in a conforming
    programming environment will get 64-bit (or wider) time_t.

    However, you can expect 32-bit time_t to survive a little longer, as implementations that currently support both 32-bit and 64-bit
    programming environments will naturally continue to support both, and
    they may well decide to declare that only the 64-bit environment
    conforms to POSIX rather than making time_t 64-bit in the 32-bit
    environment.

    On the other hand, implementations that *only* support 32-bit time_t
    will have to change in order to conform.

    --
    Geoff Clare <netnews@gclare.org.uk>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Russell Marks@21:1/5 to J Naman on Wed Nov 15 14:14:24 2023
    J Naman <jnaman2@gmail.com> wrote:

    Is there any plan or schedule for POSIX to replace the Unix 32-bit
    time [...] I am really asking if GNU awk or other awks expect to
    upgrade before or after the next revision of POSIX in 2026? [...]
    I keep running into Y2K38 issues with some US government data.

    If you use GNU awk on a *recent* Linux or *BSD, it should work
    already. "gawk 'BEGIN{print strftime("%Y",1e10)}'" on Debian Bookworm
    gives 2286, for example.

    -Rus.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to jnaman2@gmail.com on Fri Mar 8 20:11:45 2024
    In article <b2321bbf-e9a1-40d5-9261-db53a98a8dadn@googlegroups.com>,
    J Naman <jnaman2@gmail.com> wrote:
    Is there any plan or schedule for POSIX to replace the Unix 32-bit time by a >64-bit time format to avoid the Y2K38 bug ( January 19, 2038, at 03:14:07 UTC.)?
    I am really asking if GNU awk or other awks expect to upgrade before or after the
    next revision of POSIX in 2026? Is there any certainty that POSIX WILL revise >time in 2026?
    I keep running into Y2K38 issues with some US government data. mktime() is no big
    deal to handle at the user level, but strftime() IS a (the) real problem.

    This is a non-issue in GAWK. Note that AWK in general does not have an
    integer type. It just has a "number" type - and that type is a C double.

    Observe:

    % gawk 'BEGIN { print strftime("%c",1e12)}'
    Thu Sep 26 19:46:40 33658
    %

    So, I think we're good.

    --
    It's possible that leasing office space to a Starbucks is a greater liability in today's GOP than is hitting your mother on the head with a hammer.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Geoff Clare@21:1/5 to Keith Thompson on Mon Mar 11 13:32:56 2024
    Keith Thompson wrote:

    Geoff Clare <geoff@clare.See-My-Signature.invalid> writes:

    The current draft of the next POSIX revision has this in the
    description of the <sys/types.h> header:

    time_t shall be an integer type with a width (see <stdint.h>) of
    at least 64 bits.

    The revision is expected to be approved next year.
    [...]

    Do you have a link to that draft?

    https://www.opengroup.org/austin/login.html

    Access is restricted - you need to have an account on www.opengroup.org
    and be subscribed to the austin-group-l mailing list. (At least, I
    think that's all you need, but ICBW.)

    --
    Geoff Clare <netnews@gclare.org.uk>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Mr. Man-wai Chang on Mon Mar 11 14:27:11 2024
    "Mr. Man-wai Chang" <toylet.toylet@gmail.com> writes:

    Year 2038 problem is not just a software issue. You also need 64-bit CPU to compute dates.

    Since software can emulate 64-bt computations, it /is/ just a software
    issue.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kees Nuyt@21:1/5 to toylet.toylet@gmail.com on Tue Mar 12 13:28:12 2024
    On Tue, 12 Mar 2024 01:43:59 +0800, "Mr. Man-wai Chang" <toylet.toylet@gmail.com> wrote:

    On 11/3/2024 10:27 pm, Ben Bacarisse wrote:

    Since software can emulate 64-bt computations, it /is/ just a software
    issue.

    This is the part I don't quite understand.

    Even a 4-bit processor can handle 64-bit integers, signed or
    unsigned, just not with a single instruction.
    It is just a lot of code, handling 4 bits at a time, so it will
    not be fast.
    --
    Kees Nuyt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Geoff Clare@21:1/5 to Keith Thompson on Tue Mar 12 13:34:11 2024
    Keith Thompson wrote:

    "Mr. Man-wai Chang" <toylet.toylet@gmail.com> writes:
    On 9/3/2024 3:51 am, Keith Thompson wrote:
    I'm a little disappointed that POSIX doesn't require time_t to be
    signed. 64 bits is enough to represent a range of about 584 billion
    years. An unsigned time_t makes it impossible to represent times before >>> 1970.

    Could we roll our own signed time_t? :)

    I see the smiley, but I don't get the joke.

    If you're creating your own implementation, you can do anything you
    like. If not, and you're using an implementation that makes time_t an unsigned type, there's not much you can do to treat it as signed. For example, localtime() would presumably treat a time_t value of -2 as a
    very large unsigned value.

    I don't know of any implementations that make time_t an unsigned type.

    QNX is one.

    See www.qnx.net/developers/docs/6.4.0/neutrino/sys_arch/kernel.html
    which says:

    Valid dates on a QNX Neutrino system range from January 1970 to at
    least 2038. The time_t data type is an unsigned 32-bit number, which
    extends this range for many applications through 2106.

    Also, having signed time_t doesn't necessarily mean that dates before
    Jan 1970 are supported. I seem to recall that MS Windows has signed
    time_t but does not support negative values.

    --
    Geoff Clare <netnews@gclare.org.uk>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Weisgerber@21:1/5 to Geoff Clare on Tue Mar 12 14:49:28 2024
    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.

    --
    Christian "naddy" Weisgerber naddy@mips.inka.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Geoff Clare@21:1/5 to Keith Thompson on Wed Mar 13 13:46:30 2024
    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>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)