strftime et al.
Moderator, John Quarterman
std-unix at ut-sally.UUCP
Wed Dec 24 03:05:01 AEST 1986
From: chris at mimsy.umd.edu (Chris Torek)
To: std-unix at sally.utexas.edu, hpfcdg!rgt%hplabs.csnet at relay.cs.net
Date: Mon, 15 Dec 86 16:25:27 EST
The time string formats seem to express a fair number of similar
numeric entities:
...
> %H is replaced by the hour (24-hour clock) as a decimal number
> (00 to 23)
> %I is replaced by the hour (12-hour clock) as a decimal number
> (01 to 12)
...
> %U is replaced by the week number of the year with Sunday as the
> first day of the week (00 to 52)
> %V is replaced by the week number of the year with Monday as the
> first day of the week (00 to 52)
> %w is replaced by the weekday as a decimal number [0 (Sunday) to 6]
...
> %y is replaced by the year without century (00 to 99)
> %Y is replaced by the year with century
Now, time conversion may or may not be anywhere near as complex a
task as terminal control, but it seems to me that we may be repeating
the mistake made with termcap, repaired in terminfo. Rather than
defining a specific set of numeric values, perhaps strftime, like
terminfo, should have a small calculator built in. Then, e.g.,
`%y' and `%Y' are unnecessary. `%y' could push the year-with-century,
and `%{100}' the value 100; invoking mod (`%%'? the name may prove
problematical) and `%2d' could then produce the year-without-century.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP: seismo!mimsy!chris ARPA/CSNet: chris at mimsy.umd.edu
Volume-Number: Volume 8, Number 70
More information about the Mod.std.unix
mailing list