]> code.citadel.org Git - citadel.git/commitdiff
* Another minor stoopid little time display fix
authorArt Cancro <ajc@citadel.org>
Sat, 8 Apr 2000 04:52:48 +0000 (04:52 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 8 Apr 2000 04:52:48 +0000 (04:52 +0000)
citadel/ChangeLog
citadel/tools.c

index 7081740b4ea4d1e690aade62d5a098d476c24c24..87206c8480760b3ab79c6f7afbcc2616170e7a5d 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 570.16  2000/04/08 04:52:48  ajc
+ * Another minor stoopid little time display fix
+
  Revision 570.15  2000/04/08 03:58:12  nbryant
   * backed out the previous changes since they didn't look good on some
     xterms with a blue bold mode. just set the background color to black
@@ -1832,3 +1835,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
+
index 94b1e456156750b6326fdff00b16613de36f356c..46c895a15c97711934334d664876be6b44a84e52 100644 (file)
@@ -336,6 +336,7 @@ int collapsed_strcmp(char *s1, char *s2) {
  */
 void fmt_date(char *buf, time_t thetime) {
        struct tm *tm;
+       int hour;
 
        char *ascmonths[] = {
                "Jan", "Feb", "Mar", "Apr", "May", "Jun",
@@ -345,11 +346,15 @@ void fmt_date(char *buf, time_t thetime) {
        strcpy(buf, "");
        tm = localtime(&thetime);
 
-       sprintf(buf, "%s %d %d %d:%02d%s",
+       hour = tm->tm_hour;
+       if (hour == 0)  hour = 12;
+       else if (hour > 12) hour = hour - 12;
+
+       sprintf(buf, "%s %d %4d %d:%02d%s",
                ascmonths[tm->tm_mon],
                tm->tm_mday,
                tm->tm_year + 1900,
-               ( (tm->tm_hour > 12) ? (tm->tm_hour - 12) : (tm->tm_hour) ),
+               hour,
                tm->tm_min,
                ( (tm->tm_hour >= 12) ? "pm" : "am" )
        );