X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/1691e80890e5d8ba258c51c214a3e91880e1db2b..320aaed58b655cad87c9591a14fa1bf7091d72d1:/zotnet/tws/dtime.c diff --git a/zotnet/tws/dtime.c b/zotnet/tws/dtime.c index 7e791f34..adf153b6 100644 --- a/zotnet/tws/dtime.c +++ b/zotnet/tws/dtime.c @@ -5,6 +5,7 @@ * $Id$ */ +#include "h/mh.h" /* for snprintf() */ #include #include @@ -247,7 +248,7 @@ dgmtime (time_t *clock) char * dctime (struct tws *tw) { - static char buffer[25]; + static char buffer[26]; if (!tw) return NULL; @@ -459,6 +460,8 @@ set_dotw (struct tws *tw) tw->tw_wday = ((26 * month - 2) / 10 + day + year + year / 4 - 3 * century / 4 + 1) % 7; + if (tw->tw_wday < 0) + tw->tw_wday += 7; tw->tw_flags &= ~TW_SDAY, tw->tw_flags |= TW_SIMP; }