From: Peter Stephenson <pws@ifh.de>
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: PATCH: zsh-3.1.2-zefram3: 12 hour clock (2)
Date: Mon, 19 Jan 1998 10:15:25 +0100 [thread overview]
Message-ID: <199801190915.KAA25306@hydra.ifh.de> (raw)
In-Reply-To: "pws@ibmth.difi.unipi.it"'s message of "Fri, 16 Jan 1998 14:14:51 MET." <9801161314.AA38808@ibmth.difi.unipi.it>
pws@ibmth.difi.unipi.it wrote:
> It looks (as I mentioned before) as if someone has rationalised the %l
> strftime sequence to do the same as in strftime(), i.e. print a space
> before a number less than 10 in an hour given in 12-hour format.
> Since this makes me shriek with frustration every time I look at my
> prompt, which is often, the best thing to do is probably the same as
> with the 24-hour version %k, where there is an additional sequence %K
> which suppresses the space. Luckily %L is free, so this makes the 12
> and 24 hour versions nicely consistent. (Historically, both %k and %l
> suppressed the space, so this is also the natural way to update it.)
In case anybody else has been using this, there's a slight mistake
(10 is not greater than 10). Here's the corrected version.
*** 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 10:06:55 1998
***************
*** 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];
--- 1318,1323 ----
***************
*** 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;
--- 1348,1359 ----
*buf++ = '0' + tm->tm_hour % 10;
break;
case 'l':
! case 'L':
! if ((tm->tm_hour % 12) > 9)
! *buf++ = '1';
! else if (fmt[-1] == 'l')
! *buf++ = ' ';
! *buf++ = '0' + ((tm->tm_hour % 12) % 10);
break;
case 'm':
*buf++ = '0' + (tm->tm_mon + 1) / 10;
--
Peter Stephenson <pws@ifh.de> Tel: +39 50 911239
WWW: http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy
next prev parent reply other threads:[~1998-01-19 9:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-01-16 13:14 PATCH: zsh-3.1.2-zefram3: 12 hour clock in prompts pws
1998-01-16 14:27 ` Andrew Main
1998-01-16 14:48 ` Peter Stephenson
1998-01-19 9:15 ` Peter Stephenson [this message]
1998-01-19 11:23 ` PATCH: zsh-3.1.2-zefram3: 12 hour clock (3) Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199801190915.KAA25306@hydra.ifh.de \
--to=pws@ifh.de \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).