$Log$
+ Revision 590.16 2001/12/23 09:57:47 error
+ * tools.c: added parameter to fmt_date() to allow for printing the seconds
+ along with the time, e.g. 12:34 pm or 12:34:56 pm
+
Revision 590.15 2001/12/20 04:54:26 ajc
* If you paid for this software, someone is ripping you off.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
printf("%s ", &buf[5]);
}
if (!strncasecmp(buf, "time=", 5)) {
- fmt_date(now, atol(&buf[5]));
+ fmt_date(now, atol(&buf[5]), 0);
printf("%s ", now);
}
}
mode = 0;
}
- fmt_date(datestr, time(NULL));
+ fmt_date(datestr, time(NULL), 0);
header[0] = 0;
if (room_flags & QR_ANONONLY) {
/*
* Format a date/time stamp for output
+ * seconds is whether to print the seconds
*/
-void fmt_date(char *buf, time_t thetime) {
+void fmt_date(char *buf, time_t thetime, int seconds) {
struct tm *tm;
int 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,
- hour,
- tm->tm_min,
- ( (tm->tm_hour >= 12) ? "pm" : "am" )
- );
+ if (seconds) {
+ sprintf(buf, "%s %d %4d %d:%02d:%02d%s",
+ ascmonths[tm->tm_mon],
+ tm->tm_mday,
+ tm->tm_year + 1900,
+ hour,
+ tm->tm_min,
+ tm->tm_sec,
+ ( (tm->tm_hour >= 12) ? "pm" : "am" )
+ );
+ } else {
+ sprintf(buf, "%s %d %4d %d:%02d%s",
+ ascmonths[tm->tm_mon],
+ tm->tm_mday,
+ tm->tm_year + 1900,
+ hour,
+ tm->tm_min,
+ ( (tm->tm_hour >= 12) ? "pm" : "am" )
+ );
+ }
}
int haschar(char *st, int ch);
int collapsed_strcmp(char *s1, char *s2);
void remove_token(char *source, int parmnum, char separator);
-void fmt_date(char *buf, time_t thetime);
+void fmt_date(char *buf, time_t thetime, int seconds);
int is_msg_in_mset(char *mset, long msgnum);
char *memreadline(char *start, char *buf, int maxlen);