Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: zsh-3.1.2-zefram3: 12 hour clock (3)



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;



Messages sorted by: Reverse Date, Date, Thread, Author