ref: a181e3269b7ad7de2dcb6cfefaaf4db7900e2d97
parent: bcb79fa8074cb6131b5ac6ebcb1467a431a96bae
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Sep 7 15:28:30 EDT 2020
tmdate(2): fix examples, stale references (thanks deuteron) There were a number of ideas that were tried out as the tmdate api evolved. As a result, there were some references in the manpage to things that are no more. Fix them.
--- a/sys/man/2/tmdate
+++ b/sys/man/2/tmdate
@@ -57,12 +57,11 @@
.PP
Tmnow gets the current time of day in the requested time zone.
.PP
-Tmtime converts the millisecond-resolution timestamp 'abs'
+Tmtime converts the second resolution timestamp 'abs'
into a Tm struct in the requested timezone.
Tmtimens does the same, but with a nanosecond accuracy.
.PP
-Tmstime is identical to tmtime, but accepts the time in sec-
-onds.
+Tmtimens is identical to tmtime, but accepts a nanosecond argument.
.PP
Tmparse parses a time from a string according to the format argument.
Leading whitespace is ignored.
@@ -223,6 +222,7 @@
.IP
.EX
Tm a, b;
+char *e;
if(tmparse(&a, nil, "Tue Dec 10 12:36:00 PST 2019", &e) == nil)
sysfatal("failed to parse: %r");@@ -251,7 +251,7 @@
sysfatal("load zone: %r");if(tmnow(&here, zl) == nil)
sysfatal("get time: %r");-if(tmtime(&there, tmnorm(&tm), zp) == nil)
+if(tmtime(&there, tmnorm(&here), zp) == nil)
sysfatal("shift time: %r");.EE
@@ -258,12 +258,13 @@
.PP
Add a day. Because cross daylight savings, only 23 hours are added.
+.IP
.EX
Tm t;
char *date = "Sun Nov 2 13:11:11 PST 2019";
-if(tmparse(&t, "W MMM D hh:mm:ss z YYYY, date, &e) == nil)
- print("failed top parse");-tm.day++;
+if(tmparse(&t, "W MMM D hh:mm:ss z YYYY, date, nil) == nil)
+ print("failed top arse");+t.day++;
tmnorm(&t);
print("%τ", &t); /* Mon Nov 3 13:11:11 PST 2019 */.EE
@@ -273,8 +274,6 @@
Checking the timezone name against the local timezone is a
dirty hack. The same date string may parse differently for
people in different timezones.
-.PP
-There is no way to format specifier for subsecond precision.
.PP
The timezone information that we ship is out of date.
.PP
--
⑨