touch.1: Update to conform to POSIX 2004

POSIX borrowed the "double leap second" bug from C89.  Double leap seconds can
never happen.  This mistake was present in at least POSIX 1997 and fixed by
POSIX 2004.  I can't find a copy of 2001 online to determine if the bug was
present in that revision.

While here, remove duplicate language between -d and -t.  A few other minor
enhancements and an igor (lint) bugfix.

Further reading:

2018 POSIX (documents -d):
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html

2004 POSIX (documents SS from 0-60):
http://pubs.opengroup.org/onlinepubs/009695399/utilities/touch.html

1997 POSIX/SUSv2 (historical interest, 0-61):
http://pubs.opengroup.org/onlinepubs/007908799/xcu/touch.html

More on this subject (start at "Unix system time and the POSIX standard")
https://www.ucolick.org/~sla/leapsecs/onlinebib.html

And: https://marc.info/?l=openbsd-tech&m=92682843416159&w=2

Reported by:	Vishal Sahu <vsahu AT isilon.com>
Sponsored by:	Dell EMC Isilon
This commit is contained in:
cem 2018-06-01 22:34:59 +00:00
parent 9c13b943ee
commit 497a7b01e3

View File

@ -31,7 +31,7 @@
.\" @(#)touch.1 8.3 (Berkeley) 4/28/95 .\" @(#)touch.1 8.3 (Berkeley) 4/28/95
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd March 8, 2015 .Dd June 1, 2018
.Dt TOUCH 1 .Dt TOUCH 1
.Os .Os
.Sh NAME .Sh NAME
@ -53,7 +53,8 @@ If any file does not exist, it is created with default permissions.
.Pp .Pp
By default, By default,
.Nm .Nm
changes both modification and access times. The changes both modification and access times.
The
.Fl a .Fl a
and and
.Fl m .Fl m
@ -113,39 +114,36 @@ The
utility does not treat this as an error. utility does not treat this as an error.
No error messages are displayed and the exit value is not affected. No error messages are displayed and the exit value is not affected.
.It Fl d .It Fl d
Change the access and modification times to the specified time instead Change the access and modification times to the specified date time instead
of the current time of day. of the current time of day.
The argument is of the form The argument is of the form
.Dq YYYY-MM-DDThh:mm:SS[.frac][tz] .Dq YYYY-MM-DDThh:mm:SS[.frac][tz]
where the letters represent the following: where the letters represent the following:
.Bl -tag -width Ds -compact -offset indent .Bl -tag -width Ds -compact -offset indent
.It Ar YYYY .It Ar YYYY
The year. At least four decimal digits representing the year.
.It Ar MM .It Ar MM , Ar DD , Ar hh , Ar mm , Ar SS
The month of the year, from 01 to 12. As with
.It Ar DD .Fl t
The day of the month, from 01 to 31. time.
.It Ar T .It Ar T
The letter The letter
.Li T .Li T
or a space. or a space is the time designator.
.It Ar hh
The hour of the day, from 00 to 23.
.It Ar mm
The minute of the hour, from 00 to 59.
.It Ar SS
The second of the minute, from 00 to 61.
.It Ar .frac .It Ar .frac
An optional fraction, An optional fraction, consisting of a period or a comma followed by one or
consisting of a period or a comma followed by one or more digits. more digits.
The number of significant digits depends on the kernel configuration and The number of significant digits depends on the kernel configuration and the
the filesystem, and may be zero. filesystem, and may be zero.
.It Ar tz .It Ar tz
An optional letter An optional letter
.Li Z .Li Z
indicating the time is in indicating the time is in
.Tn UTC . .Tn UTC .
Otherwise, the time is assumed to be in local time. Otherwise, the time is assumed to be in local time.
Local time is affected by the value of the
.Ev TZ
environment variable.
.El .El
.It Fl h .It Fl h
If the file is a symbolic link, change the times of the link If the file is a symbolic link, change the times of the link
@ -196,7 +194,7 @@ The hour of the day, from 00 to 23.
.It Ar mm .It Ar mm
The minute of the hour, from 00 to 59. The minute of the hour, from 00 to 59.
.It Ar SS .It Ar SS
The second of the minute, from 00 to 61. The second of the minute, from 00 to 60.
.El .El
.Pp .Pp
If the If the