Removed the superfluous function fmt_date() in libcitadel since it just calls strftim...
authorroot <root@TP-13S8ZF2.tierpoint.net>
Fri, 12 May 2017 17:13:13 +0000 (13:13 -0400)
committerroot <root@TP-13S8ZF2.tierpoint.net>
Fri, 12 May 2017 17:13:13 +0000 (13:13 -0400)
libcitadel/lib/libcitadel.h
libcitadel/lib/tools.c
textclient/src/messages.c

index 87ab9f21c8caf92937c6f7ec9fa06f9ebcb9353b..a360adf27ca41755531e491eca5a73bb735b87d5 100644 (file)
@@ -441,7 +441,6 @@ void StripSlashes(char *Dir, int TrailingSlash);
 size_t striplt(char *);
 int haschar(const char *st, int ch);
 void remove_token(char *source, int parmnum, char separator);
-void fmt_date(char *buf, size_t n, time_t thetime, int seconds);
 int is_msg_in_sequence_set(const char *mset, long msgnum);
 char *memreadline(char *start, char *buf, int maxlen);
 char *memreadlinelen(char *start, char *buf, int maxlen, int *retlen);
index ad541ddf1a0ca08726a2dca123c52182395a0864..c93758e2bc1388498e895f1f21b2b272bcb81c8c 100644 (file)
@@ -2,7 +2,7 @@
  * A basic toolset containing miscellaneous functions for string manipluation,
  * encoding/decoding, and a bunch of other stuff.
  *
- * Copyright (c) 1987-2011 by the citadel.org team
+ * Copyright (c) 1987-2017 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -461,32 +461,6 @@ int haschar(const char *st, int ch)
 }
 
 
-
-
-
-/*
- * Format a date/time stamp for output 
- * seconds is whether to print the seconds
- */
-void fmt_date(char *buf, size_t n, time_t thetime, int seconds) {
-       struct tm tm;
-       char *teh_format = NULL;
-
-       *buf = '\0';
-       localtime_r(&thetime, &tm);
-
-       if (seconds) {
-               teh_format = "%F %R:%S";
-       }
-       else {
-               teh_format = "%F %R";
-       }
-
-       strftime(buf, n, teh_format, &tm);
-}
-
-
-
 /*
  * Determine whether the specified message number is contained within the
  * specified sequence set.
index 2e0d18ca5955bfbe089b9e040152b3f052c8916e..c800b7f9049b0ae16e91aef845f1ff21dc3e9789 100644 (file)
@@ -435,7 +435,7 @@ int read_message(CtdlIPC *ipc,
        FILE *dest) /* Destination file, NULL for screen */
 {
        char buf[SIZ];
-       char now[SIZ];
+       char now[256];
        int format_type = 0;
        int fr = 0;
        int nhdr = 0;
@@ -538,7 +538,9 @@ int read_message(CtdlIPC *ipc,
                        scr_printf(" ****");
                }
        } else {
-               fmt_date(now, sizeof now, message->time, 0);
+               struct tm thetime;
+               localtime_r(&message->time, &thetime);
+               strftime(now, sizeof now, "%F %R", &thetime);
                if (dest) {
                        fprintf(dest, "%s from %s ", now, message->author);
                        if (!IsEmptyStr(message->email)) {
@@ -878,7 +880,7 @@ int client_make_message(CtdlIPC *ipc,
        FILE *fp;
        int a, b, e_ex_code;
        long beg;
-       char datestr[SIZ];
+       char datestr[256];
        char header[SIZ];
        int cksum = 0;
 
@@ -887,7 +889,10 @@ int client_make_message(CtdlIPC *ipc,
                mode = 0;
        }
 
-       fmt_date(datestr, sizeof datestr, time(NULL), 0);
+       struct tm thetime;
+       time_t now = time(NULL);
+       localtime_r(&now, &thetime);
+       strftime(datestr, sizeof datestr, "%F %R", &thetime);
        header[0] = 0;
 
        if (room_flags & QR_ANONONLY && !recipient) {