From fe4c3323c971252bc5d71deb2d771fecb8ef882f Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 24 Apr 2020 10:32:34 +0000 Subject: Remove the deprecation notice for timegm(). The tzcode package marked it dprecated in the late 1980ies but it is universally supported and here to stay. Triggered by a question from Rodrigo on misc@. William Ahern listed a number of sound arguments why it shouldn't be considered deprecated, in particular that there is no better alternative, in particular none that is thread-safe. While here, fix the non-standard section name "NOTES", add the missing STANDARDS section and provide additional information in the HISTORY section, based on inspection of C89, C11, POSIX 2008, UNIX v4 and v5 at TUHS, Tahoe and Reno at the CSRG archives, amd the SunOS 3.5 and 4.0 manuals on bitsavers. Reasearch on tzcode and SunOS history done by millert@. OK millert@ on an earlier version of this patch, and deraadt@ agrees with the general direction. --- lib/libc/time/ctime.3 | 61 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/lib/libc/time/ctime.3 b/lib/libc/time/ctime.3 index 284f5f0d3b2..5000b143c4b 100644 --- a/lib/libc/time/ctime.3 +++ b/lib/libc/time/ctime.3 @@ -1,7 +1,7 @@ -.\" $OpenBSD: ctime.3,v 1.44 2015/09/14 13:08:01 schwarze Exp $ +.\" $OpenBSD: ctime.3,v 1.45 2020/04/24 10:32:33 schwarze Exp $ .\" .\" -.Dd $Mdocdate: September 14 2015 $ +.Dd $Mdocdate: April 24 2020 $ .Dt CTIME 3 .Os .Sh NAME @@ -201,7 +201,7 @@ with a negative value for .Fa tm_isdst . .Pp .Fn timegm -is a deprecated interface that converts the broken-down time, as returned by +converts the broken-down time, as returned by .Fn gmtime , into a calendar time value with the same encoding as that of the values returned by the @@ -295,12 +295,65 @@ UTC leap seconds are loaded from .Xr tzset 3 , .Xr tzfile 5 , .Xr zic 8 +.Sh STANDARDS +The functions +.Fn asctime , +.Fn ctime , +.Fn difftime , +.Fn gmtime , +.Fn localtime , +and +.Fn mktime +conform to +.St -ansiC . +.Pp +The functions +.Fn asctime_r , +.Fn ctime_r , +.Fn gmtime_r , +and +.Fn localtime_r +conform to +.St -p1003.1-2008 . +.Pp +The functions +.Fn timegm +and +.Fn timelocal +are extensions to these standards. .Sh HISTORY A .Fn ctime function first appeared in .At v1 . -.Sh NOTES +.Pp +The functions +.Fn asctime , +.Fn gmtime , +and +.Fn localtime +first appeared in +.At v5 , +.Fn difftime +and +.Fn mktime +in +.Bx 4.3 Reno , +and +.Fn timegm +and +.Fn timelocal +in SunOS 4.0. +.Pp +The functions +.Fn asctime_r , +.Fn ctime_r , +.Fn gmtime_r , +and +.Fn localtime_r +have been available since since +.Ox 2.5 . +.Sh CAVEATS The return values of the non re-entrant functions point to static data; -- cgit v1.2.3