From nobody Sat Oct 22 03:08:11 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MvR9R74Kzz4gWmb for ; Sat, 22 Oct 2022 03:08:11 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MvR9R5mP8z3y0x for ; Sat, 22 Oct 2022 03:08:11 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MvR9R4jkxzQQj for ; Sat, 22 Oct 2022 03:08:11 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 29M38Bnr028848 for ; Sat, 22 Oct 2022 03:08:11 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 29M38BLJ028847 for bugs@FreeBSD.org; Sat, 22 Oct 2022 03:08:11 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 267266] maximum date off by 1900 years from 32-bit tm_year max value? Date: Sat, 22 Oct 2022 03:08:11 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: jschauma@netmeister.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666408091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8P/HyuQoZ95uTvJcFtZvrpciGRliRFBI5YeFOGigs7A=; b=CabDgmKUp2HFFuywJk+T8wtMoxUdveoYQgsKp4tz5q12T9ANcqvyD1QNisKXvi+kxy9iNL JtVFWsEApEcwxV5QFAKJS3C0dNmB/DksKgmHrGG7nnGYdJWQC4+4D+9CEQE9E8dZ7D5r4j fAHtL5OlQz/zel7agFkMCEuxreN0x5fkpARYhu4ssPmKt6tPqXH83bq0RId0wK1vMvNrTB KthmkKH8I+glt/JYBc/ifwyU9Lx2FVZ0AhLYH4bNW7bdIvOIEDEubtZfd0ewj/BIYC3t+s BnUSjK5xN2PkiaYe6tytMsucMoj7E7xW3HvH6gu8vco34McYC3oJFBkZaYoY2w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666408091; a=rsa-sha256; cv=none; b=lbjVcw0KBk8uQH9EXOyARvi4Uy9gs5AsCmcWO/BK1rIVSD9ENqSh2rLbds2TzLpN/VAgNS abATi7+0JMmoe7ocOFNBmDIPqkfE5SHu/7Y/lWxD1r14PplxhsZ8amIpjnn9+5qGeU8ZV6 2VQGAN0J3Qk2uV42voT9WSzVEt/rrtAXcP9i0nMxqsUs+BhvMMHQ+ZouJKKOQm7larn0aW VyMRo0bwDBntmN76DR4+wmQUli/AOwpEOOwhfLmN5758B0raLD5iEOuXg8Y+EG6iaGwUoo Qft//wFGbUC3Vgdrtm0mpPUw5PocRMKoGJpn8TFBfVUvIQP7wCLH9DSTPtvHQg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267266 Bug ID: 267266 Summary: maximum date off by 1900 years from 32-bit tm_year max value? Product: Base System Version: 13.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: jschauma@netmeister.org With tm_year being a signed 32-bit int, the maximum date I should be able to represent ought to be Wed Dec 31 23:59:59 UTC 2147485547 which is epoch 67768036191676799. This works on Linux and NetBSD, for example, as well as macOS. On FreeBSD 13.1R, however, it does not: $ date -r 67768036191676799 date: invalid time $ date -r 67767976233532799 Tue Dec 31 23:59:59 UTC 2147483647 $ date -r 67767976233532800 date: invalid time Note that here the maximum value (epoch 67767976233532799) is in the year 2147483647, not in the year 2147485547. The difference between the two is 1900, suggesting that FreeBSD somehow counts tm_year as starting at the yea= r 0, not 1900. However, I can't identify where/when that is the case, as other dates correctly display tm_year as "year - 1900": struct tm *t; time_t now =3D time(NULL); t =3D gmtime(&now); printf("%s%ld %d\n", ctime(&now), now, t->tm_year); =3D> Sat Oct 22 03:06:43 2022 1666408003 122 It's unclear to me why FreeBSD then can't represent 67768036191676799. --=20 You are receiving this mail because: You are the assignee for the bug.=