Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!std-unix From: std-unix@ut-sally.UUCP (Moderator, John Quarterman) Newsgroups: mod.std.unix Subject: Re: strftime et al. Message-ID: <6708@ut-sally.UUCP> Date: Tue, 23-Dec-86 12:05:01 EST Article-I.D.: ut-sally.6708 Posted: Tue Dec 23 12:05:01 1986 Date-Received: Tue, 23-Dec-86 21:50:49 EST References: <6572@ut-sally.UUCP> Organization: IEEE P1003 Portable Operating System for Computer Environments Committee Lines: 34 Approved: jsq@sally.utexas.edu From: chris@mimsy.umd.edu (Chris Torek) To: std-unix@sally.utexas.edu, hpfcdg!rgt%hplabs.csnet@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@mimsy.umd.edu Volume-Number: Volume 8, Number 70