+ char buffer[100];
+ /* Basic functionality */
+ struct tm timeptr;
+ MKTIME( timeptr, 59, 30, 12, 1, 9, 72, 0, 274 );
+ TESTCASE( strftime( buffer, 100, "%a ", &timeptr ) == 4 );
+ TESTCASE( strcmp( buffer, "Sun " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%A ", &timeptr ) == 7 );
+ TESTCASE( strcmp( buffer, "Sunday " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%b ", &timeptr ) == 4 );
+ TESTCASE( strcmp( buffer, "Oct " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%h ", &timeptr ) == 4 );
+ TESTCASE( strcmp( buffer, "Oct " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%B ", &timeptr ) == 8 );
+ TESTCASE( strcmp( buffer, "October " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%c ", &timeptr ) == 25 );
+ TESTCASE( strcmp( buffer, "Sun Oct 1 12:30:59 1972 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%C ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "19 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%d ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "01 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%D ", &timeptr ) == 9 );
+ TESTCASE( strcmp( buffer, "10/01/72 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%e ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, " 1 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%F ", &timeptr ) == 11 );
+ TESTCASE( strcmp( buffer, "1972-10-01 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%H ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "12 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%I ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "12 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%j ", &timeptr ) == 4 );
+ TESTCASE( strcmp( buffer, "275 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%m ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "10 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%M ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "30 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%p ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "PM " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%r ", &timeptr ) == 12 );
+ TESTCASE( strcmp( buffer, "12:30:59 PM " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%R ", &timeptr ) == 6 );
+ TESTCASE( strcmp( buffer, "12:30 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%S ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "59 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%T ", &timeptr ) == 9 );
+ TESTCASE( strcmp( buffer, "12:30:59 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%u ", &timeptr ) == 2 );
+ TESTCASE( strcmp( buffer, "7 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%w ", &timeptr ) == 2 );
+ TESTCASE( strcmp( buffer, "0 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%x ", &timeptr ) == 9 );
+ TESTCASE( strcmp( buffer, "10/01/72 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%X ", &timeptr ) == 9 );
+ TESTCASE( strcmp( buffer, "12:30:59 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%y ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "72 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%Y ", &timeptr ) == 5 );
+ TESTCASE( strcmp( buffer, "1972 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%% ", &timeptr ) == 2 );
+ TESTCASE( strcmp( buffer, "% " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%n ", &timeptr ) == 2 );
+ TESTCASE( strcmp( buffer, "\n " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%t ", &timeptr ) == 2 );
+ TESTCASE( strcmp( buffer, "\t " ) == 0 );
+ /* ISO week calculation */
+ MKTIME( timeptr, 0, 0, 0, 27, 11, 3, 0, 360 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "52 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 28, 11, 3, 1, 361 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "53 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 31, 11, 3, 4, 364 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "53 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 1, 0, 4, 5, 0 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "53 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 3, 0, 4, 0, 2 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "53 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%g ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "03 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%G ", &timeptr ) == 5 );
+ TESTCASE( strcmp( buffer, "1903 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 4, 0, 4, 1, 3 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "01 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%g ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "04 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%G ", &timeptr ) == 5 );
+ TESTCASE( strcmp( buffer, "1904 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 1, 0, 5, 0, 0 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "52 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%g ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "04 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%G ", &timeptr ) == 5 );
+ TESTCASE( strcmp( buffer, "1904 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 24, 11, 100, 0, 358 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "51 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 25, 11, 100, 1, 359 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "52 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 31, 11, 100, 0, 365 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "52 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%g ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "00 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%G ", &timeptr ) == 5 );
+ TESTCASE( strcmp( buffer, "2000 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 1, 0, 101, 1, 0 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "01 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%g ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "01 " ) == 0 );
+ TESTCASE( strftime( buffer, 100, "%G ", &timeptr ) == 5 );
+ TESTCASE( strcmp( buffer, "2001 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 7, 0, 101, 7, 6 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "01 " ) == 0 );
+ MKTIME( timeptr, 0, 0, 0, 8, 0, 101, 1, 7 );
+ TESTCASE( strftime( buffer, 100, "%V ", &timeptr ) == 3 );
+ TESTCASE( strcmp( buffer, "02 " ) == 0 );
+ return TEST_RESULTS;