X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=textclient%2Fsrc%2Fmessages.c;h=c800b7f9049b0ae16e91aef845f1ff21dc3e9789;hb=365a7b93fe804fe6c618946086fc74c2c39b2dae;hp=5b694e85c58543c8d5ace6be545678625e5f84ca;hpb=6fcf52d210b8b1da3652f2e3384f67989b247e33;p=citadel.git diff --git a/textclient/src/messages.c b/textclient/src/messages.c index 5b694e85c..c800b7f90 100644 --- a/textclient/src/messages.c +++ b/textclient/src/messages.c @@ -1,7 +1,7 @@ /* * Text client functions for reading and writing of messages * - * Copyright (c) 1987-2012 by the citadel.org team + * Copyright (c) 1987-2016 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 version 3. @@ -43,16 +43,12 @@ #include #include -///#include "citadel.h" #include "citadel_ipc.h" #include "citadel_decls.h" #include "messages.h" #include "commands.h" #include "tuiconfig.h" #include "rooms.h" -//#ifndef HAVE_SNPRINTF -///#include "snprintf.h" -//#endif #include "screen.h" #define MAXWORDBUF SIZ @@ -439,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; @@ -542,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)) { @@ -882,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; @@ -891,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) {