]> code.citadel.org Git - citadel.git/commitdiff
* tools.c: added parameter to fmt_date() to allow for printing the seconds
authorMichael Hampton <io_error@uncensored.citadel.org>
Sun, 23 Dec 2001 09:57:47 +0000 (09:57 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sun, 23 Dec 2001 09:57:47 +0000 (09:57 +0000)
  along with the time, e.g. 12:34 pm or 12:34:56 pm

citadel/ChangeLog
citadel/messages.c
citadel/tools.c
citadel/tools.h

index f06b487f2357d07d4cf52d7cb9a587db58518bb7..cc913eaca8b149cedad8c832cc38fb55129e305a 100644 (file)
@@ -1,4 +1,8 @@
  $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.
 
@@ -2995,3 +2999,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index 8bd1700519b73c45b28dc69e6dc379c44e6d2e29..59f42bc58e5dedc9f81fde0d1566b498e3d0e92f 100644 (file)
@@ -478,7 +478,7 @@ int read_message(
                        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);
                }
        }
@@ -619,7 +619,7 @@ int make_message(char *filename,    /* temporary file name */
                        mode = 0;
                }
 
-       fmt_date(datestr, time(NULL));
+       fmt_date(datestr, time(NULL), 0);
        header[0] = 0;
 
        if (room_flags & QR_ANONONLY) {
index a62fe39d9f514f78bafa9f9ae00e80b686443ddb..1ef4a53a31d61d3b87f16957354e10519c5c2d75 100644 (file)
@@ -378,8 +378,9 @@ int collapsed_strcmp(char *s1, char *s2) {
 
 /*
  * 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;
 
@@ -395,14 +396,26 @@ void fmt_date(char *buf, time_t thetime) {
        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" )
+               );
+       }
 }
 
 
index b36e175586fc4075546881af8457571db646d713..36532f40896149b0ae05fff048db4ac33d4bcd5b 100644 (file)
@@ -10,7 +10,7 @@ void striplt(char *);
 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);