Skip to content

Commit 3c7f02f

Browse files
committed
Add missing documentation for -validate option to clock scan
1 parent 44b21ce commit 3c7f02f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

doc/clock.n

+13-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Specifies the desired output format for \fBclock format\fR or the
132132
expected input format for \fBclock scan\fR. The \fIformat\fR string consists
133133
of any number of characters other than the per-cent sign
134134
.PQ \fB%\fR
135-
interspersed with any number of \fIformat groups\fR, which are two-character
135+
interspersed with any number of \fIformat groups\fR, which are two- or three-character
136136
sequences beginning with the per-cent sign. The permissible format groups,
137137
and their interpretation, are described under \fBFORMAT GROUPS\fR.
138138
.RS
@@ -194,6 +194,15 @@ the environment variable \fBTZ\fR.
194194
.IP [3]
195195
on Windows systems, the time zone settings from the Control Panel.
196196
.RE
197+
.\" OPTION: -validate
198+
.TP
199+
\fB\-validate\fR boolean
200+
.
201+
If \fIboolean\fR is true (default), \fBclock scan\fR will raise an error
202+
if the input contains invalid values, e.g. day of month greater than
203+
number of days in the month. If specified as false, the command makes
204+
an adjustment to bring values within acceptable range. See
205+
\fBSCANNING TIMES\fT for details.
197206
.PP
198207
If none of these is present, the C \fBlocaltime\fR and \fBmktime\fR
199208
functions are used to attempt to convert times between local and
@@ -492,7 +501,9 @@ time zone when converting local times. This caveat does not apply to
492501
UTC times.)
493502
.PP
494503
If the interpretation of the groups yields an impossible time because
495-
a field is out of range, enough of that field's unit will be added to
504+
a field is out of range, an exception is raised if the \fB-validate\fR
505+
option is not present or passed as true. If passed as false,
506+
enough of that field's unit will be added to
496507
or subtracted from the time to bring it in range. Thus, if attempting to
497508
scan or format day 0 of the month, one day will be subtracted from day
498509
1 of the month, yielding the last day of the previous month.

0 commit comments

Comments
 (0)