$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
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
+
*/
void fmt_date(char *buf, time_t thetime) {
struct tm *tm;
+ int hour;
char *ascmonths[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
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" )
);