On Sun, Aug 23, 2020 at 10:25:37AM -0600, Todd C. Miller wrote: > Both gawk and mawk include mktime() in their time functions. > We have strftime() and systime() but no mktime(). The following > diff makes our awk more compatible with other implementations. > > - todd >
hi/ i think the text is fine. could you add mktime to the list of extensions in STANDARDS too? jmc > Index: usr.bin/awk/awk.1 > =================================================================== > RCS file: /cvs/src/usr.bin/awk/awk.1,v > retrieving revision 1.56 > diff -u -p -u -r1.56 awk.1 > --- usr.bin/awk/awk.1 24 Jul 2020 01:57:06 -0000 1.56 > +++ usr.bin/awk/awk.1 23 Aug 2020 16:22:46 -0000 > @@ -684,6 +684,41 @@ This version of > provides the following functions for obtaining and formatting time > stamps. > .Bl -tag -width indent > +.It Fn mktime datespec > +Converts > +.Fa datespec > +into a timestamp in the same form as a value returned by > +.Fn systime . > +The > +.Fa datespec > +is a string composed of six or seven numbers separated by whitespace: > +.Bd -literal -offset indent > +YYYY MM DD HH MM SS [DST] > +.Ed > +.Pp > +The fields in > +.Fa datespec > +are as follows: > +.Bl -tag -width "YYYY" > +.It YYY > +Year: a four-digit year, including the century. > +.It MM > +Month: a number from 1 to 12. > +.It DD > +Day: a number from 1 to 31. > +.It HH > +Hour: a number from 0 to 23. > +.It MM > +Minute: a number from 0 to 59. > +.It SS > +Second: a number from 0 to 60 (permitting a leap second). > +.It DST > +Daylight Saving Time: a positive or zero value indicates that > +DST is or is not in effect. > +If DST is not specified, or is negative, > +.Fn mktime > +will attempt to determine the correct value. > +.El > .It Fn strftime "[format [, timestamp]]" > Formats > .Ar timestamp > @@ -696,6 +731,8 @@ manual page, as well as any arbitrary te > The > .Ar timestamp > must be in the same form as a value returned by > +.Fn mktime > +and > .Fn systime . > If > .Ar timestamp