diff options
author | Ori Bernstein <ori@eigenstate.org> | 2020-09-07 19:28:30 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2020-09-07 19:28:30 -0700 |
commit | ce5b6036f04ca6af1cb1fe2992c86eb6ad47cf22 (patch) | |
tree | 85787a11ce803e14de036ec2805676988e1294e0 | |
parent | 4a1186ddfe422c94f16e0d21efda599bb4556355 (diff) | |
download | plan9front-ce5b6036f04ca6af1cb1fe2992c86eb6ad47cf22.tar.xz |
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.
-rw-r--r-- | sys/man/2/tmdate | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/man/2/tmdate b/sys/man/2/tmdate index 2f4f711ea..4a9a23e48 100644 --- a/sys/man/2/tmdate +++ b/sys/man/2/tmdate @@ -57,12 +57,11 @@ does not leak. .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 @@ Done with full, strict error checking. .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,19 +251,20 @@ if((zp = tzload("US_Pacific")) == nil) 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 .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 @@ -274,8 +275,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 The Plan 9 timezone format has no way to express leap seconds. |