From: Theo Buehler Subject: Re: Document timegm() error return To: tech@openbsd.org Date: Mon, 13 Apr 2026 06:16:14 +0200 On Mon, Apr 13, 2026 at 06:11:54AM +0200, Theo Buehler wrote: > The RETURN VALUE of timegm() is undocumented. > > mktime() and timegm() call time1(), which returns WRONG aka -1 on error. > Of course, struct tm can represent Dec 31, 1969, 23:59:59, so this is > not necessarily an error. Wording adapted from ASN1_INTEGER_get(), which > suffers from the same fundamental design flaw. > > It may well deserve more calling out, e.g., in DESCRIPTION and CAVEATS. > I'll leave that for someone else to fix. ENOCOFFEE. Here's the diff I wanted to send. timegm, not gmtime. Index: time/ctime.3 =================================================================== RCS file: /cvs/src/lib/libc/time/ctime.3,v diff -u -p -r1.50 ctime.3 --- time/ctime.3 20 Nov 2025 10:58:11 -0000 1.50 +++ time/ctime.3 13 Apr 2026 04:15:11 -0000 @@ -278,9 +278,12 @@ The functions and .Fn gmtime_r return NULL on error. -The function +The functions .Fn mktime -returns \-1 on error. +and +.Fn timegm +return \-1 on error, +which is ambiguous because \-1 is a legitimate conversion result. .Sh FILES .Bl -tag -width "/usr/share/zoneinfo/posixrules" -compact .It Pa /usr/share/zoneinfo