Index: ChangeLog =================================================================== RCS file: /cvs/ecos/ecos/packages/language/c/libc/time/current/ChangeLog,v retrieving revision 1.20 diff -u -r1.20 ChangeLog --- ChangeLog 27 Mar 2005 17:28:26 -0000 1.20 +++ ChangeLog 16 Jun 2006 18:45:26 -0000 @@ -1,3 +1,13 @@ +2006-06-16 Andrew Lunn + + * tests/strptime.c: Add a testcase for the previous fix. + +2006-06-13 Dan Jakubiec + + * src/strptime.cxx: Removed the initialization of the struct tm fields + to prevent clobbering of time values when using the following format + specifiers: %D, %r, %R, %T, %X, %x. + 2005-03-27 Andrew Lunn * include/time.h: Added CYGBLD_ATTRIB_STRFTIME_FORMAT where Index: src/strptime.cxx =================================================================== RCS file: /cvs/ecos/ecos/packages/language/c/libc/time/current/src/strptime.cxx,v retrieving revision 1.5 diff -u -r1.5 strptime.cxx --- src/strptime.cxx 8 Aug 2004 22:39:25 -0000 1.5 +++ src/strptime.cxx 16 Jun 2006 18:45:27 -0000 @@ -186,17 +186,6 @@ { char c; - timeptr->tm_yday = 1; // Initialize to a well known, valid date - timeptr->tm_isdst = 0; // Tuesday March 18 14:05:00 2003 UTC - timeptr->tm_sec = 0; - timeptr->tm_min = 5; - timeptr->tm_hour = 14; - timeptr->tm_mday = 18; - timeptr->tm_mon = 2; - timeptr->tm_year = 103; - timeptr->tm_wday = 2; - timeptr->tm_yday = 77; - for (; (c = *format) != '\0'; ++format) { char *s; int ret; Index: tests/strptime.c =================================================================== RCS file: /cvs/ecos/ecos/packages/language/c/libc/time/current/tests/strptime.c,v retrieving revision 1.1 diff -u -r1.1 strptime.c --- tests/strptime.c 27 Jan 2003 22:10:15 -0000 1.1 +++ tests/strptime.c 16 Jun 2006 18:45:27 -0000 @@ -57,7 +57,7 @@ #include #include - +#include // strlen() // HOW TO START TESTS # define START_TEST( test ) test(0) @@ -96,6 +96,17 @@ size = strftime(s, sizeof(s), fp, &tm1); CYG_TEST_PASS_FAIL(((size==strlen(dp)) && (my_strcmp(s, dp) == 0)), "strptime test #4"); + dp = "2006:06:13 12:22:01"; + fp = "%x %X"; + sp = strptime(dp, fp, &tm1); + CYG_TEST_PASS_FAIL(((sp!=NULL) && (*sp=='\0')), "strptime test #5"); + CYG_TEST_PASS_FAIL((tm1.tm_sec == 01) && + (tm1.tm_min == 22) && + (tm1.tm_hour == 12) && + (tm1.tm_mday == 13) && + (tm1.tm_mon == (06 - 1)) && + (tm1.tm_year == (2006 - 1900)), "strptime test #6"); + size = strftime(s, sizeof(s), fp, &tm1); CYG_TEST_FINISH("Finished tests from testcase " __FILE__ " for C library " "strptime() function"); } // test()