zsh-workers
 help / color / mirror / code / Atom feed
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 (3)
Date: Mon, 19 Jan 1998 12:23:03 +0100	[thread overview]
Message-ID: <199801191123.MAA01632@hydra.ifh.de> (raw)
In-Reply-To: "Peter Stephenson"'s message of "Mon, 19 Jan 1998 10:15:25 MET." <199801190915.KAA25306@hydra.ifh.de>

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;


      reply	other threads:[~1998-01-19 11:44 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 ` PATCH: zsh-3.1.2-zefram3: 12 hour clock (2) Peter Stephenson
1998-01-19 11:23   ` Peter Stephenson [this message]

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=199801191123.MAA01632@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).