diff options
-rw-r--r-- | games/hack/hack.unix.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/games/hack/hack.unix.c b/games/hack/hack.unix.c index f038795a7e0..15a50c46a0a 100644 --- a/games/hack/hack.unix.c +++ b/games/hack/hack.unix.c @@ -58,10 +58,8 @@ getdate() static char datestr[7]; register struct tm *lt = getlt(); - (void) sprintf(datestr, "%2d%2d%2d", - lt->tm_year, lt->tm_mon + 1, lt->tm_mday); - if(datestr[2] == ' ') datestr[2] = '0'; - if(datestr[4] == ' ') datestr[4] = '0'; + (void) snprintf(datestr, sizeof(datestr), "%02d%02d%02d", + lt->tm_year % 100, lt->tm_mon + 1, lt->tm_mday); return(datestr); } |