ref: eb6b1e672c33a9dce0de368a0e954b801f2035d3
parent: 022bc980b88ca6c06df2f4055ecc0b62231f01ea
parent: 9f8d62ab644553b11286dbcd283db56c83d6ebdd
author: Ori Bernstein <[email protected]>
date: Fri Sep 25 12:51:08 EDT 2020
merge
--- a/sys/man/2/tmdate
+++ b/sys/man/2/tmdate
@@ -134,8 +134,7 @@
will format to a width of 3. When parsing, this acts as whitespace.
.TP
.B ?
-When parsing, this makes the following argument match fuzzily.
-Fuzzy matching means that all formats are tried, from most to least specific.
+When parsing, all formats of the following argument are tried from most to least specific.
For example,
.I ?M
will match
@@ -144,7 +143,9 @@
.IR 01 ,
and
.IR 1 ,
-in that order of preference.
+in that order. When formatting,
+.B ?
+is ignored.
.TP
.B ~
When parsing a date, this slackens range enforcement, accepting
--- a/sys/src/libc/port/date.c
+++ b/sys/src/libc/port/date.c
@@ -330,7 +330,7 @@
if(d < 0)
d += mdays[m - 1];
- tm->yday = d;
+ tm->yday = d - 1;
for(i = 0; i < m - 1; i++)
tm->yday += mdays[i];
if(m > 1 && isleap(y))
@@ -428,6 +428,9 @@
switch(c0){
case 0:
break;
+ /* Ignore '?' so we can share parse and format strings */
+ case '?':
+ continue;
case 'Y':
switch(w){
case 1: n += fmtprint(f, "%*d", pad, tm->year + 1900); break;