From: <sv...@ww...> - 2006-04-08 20:49:03
|
Author: mkrose Date: 2006-04-08 13:48:54 -0700 (Sat, 08 Apr 2006) New Revision: 1877 Modified: trunk/csp/csplib/data/Date.cpp Log: Workaround for a date formatting bug in msvc runtime libraries. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1877 Modified: trunk/csp/csplib/data/Date.cpp =================================================================== --- trunk/csp/csplib/data/Date.cpp 2006-04-08 20:41:34 UTC (rev 1876) +++ trunk/csp/csplib/data/Date.cpp 2006-04-08 20:48:54 UTC (rev 1877) @@ -298,6 +298,7 @@ tm->tm_mday = getDay(); tm->tm_mon = getMonth() - 1; /* 0-11 goes in tm */ tm->tm_year = getYear() - 1900; /* X/Open says tm_year can be negative */ + tm->tm_year = std::max(0, tm->tm_year); /* but msvcrt's strftime can't handle negative years! */ weekday_t day = getWeekday(); if (day == 7) day = 0; /* struct tm wants days since Sunday, so Sunday is 0 */ |