From 192f207c78562be506d50dfb94c5c32a57bf95ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 27 Apr 2004 00:50:01 +0000 Subject: [PATCH] Absolutely didn't like negative values for tm_wday and tm_mon before. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7327 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/time/asctime.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kernel/libroot/posix/time/asctime.c b/src/kernel/libroot/posix/time/asctime.c index f2eb144be9..2f8a5210ad 100644 --- a/src/kernel/libroot/posix/time/asctime.c +++ b/src/kernel/libroot/posix/time/asctime.c @@ -22,7 +22,8 @@ print_time(char *buffer, size_t bufferSize, const struct tm *tm) }; snprintf(buffer, bufferSize, "%.3s %.3s%3d %02d:%02d:%02d %d\n", - weekdays[tm->tm_wday % 7], months[tm->tm_mon % 12], + tm->tm_wday < 0 ? "???" : weekdays[tm->tm_wday % 7], + tm->tm_mon < 0 ? "???" : months[tm->tm_mon % 12], tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, 1900 + tm->tm_year);