Menu

#86 Pad date with zeroes in MOTD (YYYY-m-d -> YYYY-mm-dd)

u2.10.12
open
nobody
None
5
2013-11-04
2013-11-04
No

ISO 8601.

diff --git a/ircd/motd.c b/ircd/motd.c
index 5602dd4..dda18d1 100644
--- a/ircd/motd.c
+++ b/ircd/motd.c
@@ -291,7 +291,7 @@ motd_forward(struct Client *cptr, struct MotdCache *cache)

   /* send the motd */
   send_reply(cptr, RPL_MOTDSTART, cli_name(&me));
-  send_reply(cptr, SND_EXPLICIT | RPL_MOTD, ":- %d-%d-%d %d:%02d",
+  send_reply(cptr, SND_EXPLICIT | RPL_MOTD, ":- %04d-%02d-%02d %02d:%02d",
         cache->modtime.tm_year + 1900, cache->modtime.tm_mon + 1,
         cache->modtime.tm_mday, cache->modtime.tm_hour,
         cache->modtime.tm_min);
@@ -336,7 +336,8 @@ motd_signon(struct Client* cptr)
     send_reply(cptr, SND_EXPLICIT | RPL_MOTD, ":\002Type /MOTD to read the "
           "AUP before continuing using this service.\002");
     send_reply(cptr, SND_EXPLICIT | RPL_MOTD, ":The message of the day was "
-          "last changed: %d-%d-%d %d:%d", cache->modtime.tm_year + 1900,
+          "last changed: %04d-%02d-%02d %02d:%02d",
+          cache->modtime.tm_year + 1900,
           cache->modtime.tm_mon + 1, cache->modtime.tm_mday,
           cache->modtime.tm_hour, cache->modtime.tm_min);
     send_reply(cptr, RPL_ENDOFMOTD);

Discussion


Log in to post a comment.