]> code.citadel.org Git - citadel.git/commitdiff
* Small cosmetic change to date/time output
authorArt Cancro <ajc@citadel.org>
Sun, 19 Mar 2000 23:04:08 +0000 (23:04 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 19 Mar 2000 23:04:08 +0000 (23:04 +0000)
citadel/ChangeLog
citadel/citadel.h
citadel/messages.c
citadel/tools.c
citadel/tools.h

index 146cba17141a82765f9362d80b06a1268e34425b..2811a4a7a9524b7be8d43e4c0b1c80ea71e06f50 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 1.494  2000/03/19 23:04:08  ajc
+ * Small cosmetic change to date/time output
+
  Revision 1.493  2000/03/19 05:02:39  ajc
  * SMTP hacks to deal with AOL braindamage
 
@@ -1762,3 +1765,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
+
index c5a2446096c0315bb720dbd8b0ee81cbda34c05e..6a74b5728a1a0673af04e6bb20836b2cad8b7347 100644 (file)
@@ -8,7 +8,7 @@
 #include "sysdep.h"
 #include "sysconfig.h"
 #include "ipcdef.h"
-#define CITADEL        "Citadel/UX 5.70b1"
+#define CITADEL        "Citadel/UX 5.70b2"
 #define REV_LEVEL 570
 #define SERVER_TYPE 0  /* zero for stock Citadel/UX; other developers please
                           obtain SERVER_TYPE codes for your implementations */
index 9d26571101452e6c002fb479026faa42b024f408..cbfe2b2495c0164b6a0246158cc9bbca152f8979 100644 (file)
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>
-#include <time.h>
 #include <signal.h>
 #include <errno.h>
 #include <limits.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
+#include <sys/time.h>
 #include <stdarg.h>
 #include "citadel.h"
 #include "messages.h"
@@ -322,8 +322,7 @@ int read_message(long int num, char pagin) /* Read a message from the server */
        char buf[256];
        char m_subject[256];
        char from[256], node[256], rfca[256];
-       time_t now;
-       struct tm *tm;
+       char now[256];
        int format_type = 0;
        int fr = 0;
        int nhdr = 0;
@@ -443,12 +442,8 @@ int read_message(long int num, char pagin) /* Read a message from the server */
                        printf("%s ",&buf[5]);
                        }
                if (!struncmp(buf,"time=",5)) {
-                       now=atol(&buf[5]);
-                       tm=(struct tm *)localtime(&now);
-                       strcpy(buf,asctime(tm)); buf[strlen(buf)-1]=0;
-                       strcpy(&buf[16],&buf[19]);
-                       color(BRIGHT_MAGENTA);
-                       printf("%s ",&buf[4]);
+                       fmt_date(now, atol(&buf[5]));
+                       printf("%s ", now);
                        }
                }
 
@@ -570,7 +565,6 @@ int make_message(char *filename,    /* temporary file name */
 { 
        FILE *fp;
        int a,b,e_ex_code;
-       time_t now;
        long beg;
        char datestr[64];
        int cksum = 0;
@@ -580,9 +574,7 @@ int make_message(char *filename,    /* temporary file name */
                mode=0;
                }
 
-       time(&now);
-       strcpy(datestr,asctime(localtime(&now)));
-       datestr[strlen(datestr)-1] = 0;
+       fmt_date(datestr, time(NULL));
 
        if (room_flags & QR_ANONONLY) {
                printf(" ****");
index 9026d68bc8c89a97da4861a067f9b0726ff8a3d3..5955db8b936c50f627bba61c17a78df68f44c5ae 100644 (file)
@@ -7,6 +7,7 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <string.h>
+#include <sys/time.h>
 #include "tools.h"
 
 #define TRUE  1
@@ -327,3 +328,35 @@ int collapsed_strcmp(char *s1, char *s2) {
        free(c2);
        return(ret);
 }
+
+
+
+/*
+ * Format a date/time stamp for output 
+ */
+void fmt_date(char *buf, time_t thetime) {
+       struct tm *tm;
+
+       char *ascmonths[] = {
+               "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+       };
+
+       strcpy(buf, "");
+       tm = localtime(&thetime);
+
+       sprintf(buf, "%s %d %d %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) ),
+               tm->tm_min,
+               ( (tm->tm_hour > 12) ? "pm" : "am" )
+       );
+}
+
+
+
+
+
+
index a40831c2aa66545be7b75ced1ed483525d4e7547..9def9852d1f9840e82d7ea5419f2d1a70fbbc607 100644 (file)
@@ -10,6 +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);
 
 #define extract(dest,source,parmnum)   extract_token(dest,source,parmnum,'|')
 #define num_parms(source)              num_tokens(source, '|')