1 /* 2 * Copyright (c) 2003, Intel Corporation. All rights reserved. 3 * Created by: majid.awad REMOVE-THIS AT intel DOT com 4 * This file is licensed under the GPL license. For the full content 5 * of this license, see the COPYING file at the top level of this 6 * source tree. 7 * 8 * 9 * This test case shall return PASS on converting the broken down July 4th 2001 10 * into a time since the Epoch, which is the same encoding as of the value 11 * returned by time(), otherwise it fails with -1. 12 */ 13 14 #include <stdio.h> 15 #include <time.h> 16 #include "posixtest.h" 17 18 struct tm tm_ptr; 19 time_t tps; 20 main(void)21int main(void) 22 { 23 /* Break down July 4th, 2001 */ 24 tm_ptr.tm_year = 2001 - 1900; 25 tm_ptr.tm_mon = 7 - 1; 26 tm_ptr.tm_mday = 4; 27 tm_ptr.tm_hour = 0; 28 tm_ptr.tm_min = 0; 29 tm_ptr.tm_sec = 1; 30 tm_ptr.tm_isdst = -1; 31 32 tps = mktime(&tm_ptr); 33 34 if (tps != -1) { 35 printf("%s", ctime(&tps)); 36 puts("TEST PASSED"); 37 return PTS_PASS; 38 } else { 39 puts("TEST FAILED"); 40 return PTS_FAIL; 41 } 42 } 43