From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6072 invoked from network); 19 Jan 1998 11:44:31 -0000 Received: from ns2.primenet.com.au (7795@203.24.36.3) by ns1.primenet.com.au with SMTP; 19 Jan 1998 11:44:31 -0000 Received: (qmail 798 invoked from network); 19 Jan 1998 11:44:29 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns2.primenet.com.au with SMTP; 19 Jan 1998 11:44:29 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id GAA29989; Mon, 19 Jan 1998 06:21:32 -0500 (EST) Resent-Date: Mon, 19 Jan 1998 06:21:32 -0500 (EST) Message-Id: <199801191123.MAA01632@hydra.ifh.de> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: PATCH: zsh-3.1.2-zefram3: 12 hour clock (3) In-reply-to: "Peter Stephenson"'s message of "Mon, 19 Jan 1998 10:15:25 MET." <199801190915.KAA25306@hydra.ifh.de> Date: Mon, 19 Jan 1998 12:23:03 +0100 From: Peter Stephenson Resent-Message-ID: <"TH4t43.0.WK7.xSpmq"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3731 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu GAH! I'll get this right eventually. The only problem is not being able to count. *** Doc/Zsh/prompt.yo.%L Fri Jan 16 14:26:01 1998 --- Doc/Zsh/prompt.yo Fri Jan 16 14:26:23 1998 *************** *** 103,112 **** ) item(tt(%D{)var(string)tt(}))( var(string) is formatted using the tt(strftime) function. ! See manref(strftime)(3) for more details. Two additional codes are available: tt(%f) prints the day of the month, like tt(%e) but ! without any preceding space if the day is a single digit, and tt(%K) ! corresponds to tt(%k) for the hour of the day in the same way. ) item(tt(%l))( The line (tty) the user is logged in on. --- 103,113 ---- ) item(tt(%D{)var(string)tt(}))( var(string) is formatted using the tt(strftime) function. ! See manref(strftime)(3) for more details. Three additional codes are available: tt(%f) prints the day of the month, like tt(%e) but ! without any preceding space if the day is a single digit, and ! tt(%K)/tt(%L) correspond to tt(%k)/tt(%l) for the hour of the day ! (24/12 hour clock) in the same way. ) item(tt(%l))( The line (tty) the user is logged in on. *** Src/utils.c.%L Fri Jan 16 14:22:27 1998 --- Src/utils.c Mon Jan 19 12:06:59 1998 *************** *** 1309,1314 **** --- 1309,1315 ---- int ztrftime(char *buf, int bufsize, char *fmt, struct tm *tm) { + int hr12; #ifndef HAVE_STRFTIME static char *astr[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; *************** *** 1318,1326 **** #else char *origbuf = buf; #endif - static char *lstr[] = - {"12", " 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9", - "10", "11"}; char tmp[3]; --- 1319,1324 ---- *************** *** 1351,1357 **** *buf++ = '0' + tm->tm_hour % 10; break; case 'l': ! strucpy(&buf, lstr[tm->tm_hour % 12]); break; case 'm': *buf++ = '0' + (tm->tm_mon + 1) / 10; --- 1349,1363 ---- *buf++ = '0' + tm->tm_hour % 10; break; case 'l': ! case 'L': ! hr12 = tm->tm_hour % 12; ! if (hr12 == 0) ! hr12 = 12; ! if (hr12 > 9) ! *buf++ = '1'; ! else if (fmt[-1] == 'l') ! *buf++ = ' '; ! *buf++ = '0' + (hr12 % 10); break; case 'm': *buf++ = '0' + (tm->tm_mon + 1) / 10;