Subject: w and uptime show strange clock
To: None <tech-userlevel@NetBSD.ORG>
From: Martin Husemann <martin@duskware.de>
List: tech-userlevel
Date: 05/22/2003 11:15:28
It seems that w (and uptime) are the only (?) utilities in the tree that
force a 12 hour clock representation.

I wondered if there are any standards requiring this?

Furthermore, when I started to look for a bettter way to do it, I found
(to my surprise) that strftime offers apparently nothing better than %X
(or NetBSDs locale subsystem is not yet good enough to make %X into 
a 12 hour display in locales that prefer this).

Index: w.c
===================================================================
RCS file: /cvsroot/src/usr.bin/w/w.c,v
retrieving revision 1.58
diff -u -r1.58 w.c
--- w.c	2003/02/26 19:10:28	1.58
+++ w.c	2003/05/22 09:10:48
@@ -476,7 +476,7 @@
 	 * SCCS forces the string manipulation below, as it replaces
 	 * %, M, and % in a character string with the file name.
 	 */
-	(void)strftime(buf, sizeof(buf), "%l:%" "M%p", localtime(nowp));
+	(void)strftime(buf, sizeof(buf), "%X", localtime(nowp));
 	buf[sizeof(buf) - 1] = '\0';
 	(void)printf("%s ", buf);
 

Not that I realy care - just curious...


Martin