]> diplodocus.org Git - nmh/blobdiff - sbr/dtime.c
mhbuildsbr.c: Flip logic, moving goto to then-block; no need for else.
[nmh] / sbr / dtime.c
index b3ca012a860ce8eace93f8643acf1bc69bc121b9..56d874e0394079559e9b3449610363a3e5178896 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <h/mh.h>   /* for snprintf() */
 #include <h/nmh.h>
 
 #include <h/mh.h>   /* for snprintf() */
 #include <h/nmh.h>
+#include <h/utils.h>
 #include <h/tws.h>
 #include <time.h>
 
 #include <h/tws.h>
 #include <time.h>
 
@@ -178,15 +179,15 @@ dgmtime (time_t *clock)
 char *
 dctime (struct tws *tw)
 {
 char *
 dctime (struct tws *tw)
 {
-    static char buffer[64];
+    static char buffer[26];
 
     if (!tw)
        return NULL;
 
 
     if (!tw)
        return NULL;
 
-    snprintf (buffer, sizeof(buffer), "%.3s %.3s %02d %02d:%02d:%02d %.4d\n",
+    snprintf (buffer, sizeof(buffer), "%.3s %.3s %02d %02d:%02d:%02d %s\n",
            tw_dotw[tw->tw_wday], tw_moty[tw->tw_mon], tw->tw_mday,
            tw->tw_hour, tw->tw_min, tw->tw_sec,
            tw_dotw[tw->tw_wday], tw_moty[tw->tw_mon], tw->tw_mday,
            tw->tw_hour, tw->tw_min, tw->tw_sec,
-           tw->tw_year < 100 ? tw->tw_year + 1900 : tw->tw_year);
+           m_strn(tw->tw_year < 100 ? tw->tw_year + 1900 : tw->tw_year, 4));
 
     return buffer;
 }
 
     return buffer;
 }