Home | History | Annotate | Download | only in ctime
      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 checks if the return value of the ctime call is
     10  * not NULL after converting the time value to a date and time string.
     11  */
     12 
     13 #include <stdio.h>
     14 #include <time.h>
     15 #include "posixtest.h"
     16 
     17 int main(void)
     18 {
     19 	time_t current_time;
     20 	char *result;
     21 
     22 	time(&current_time);
     23 	result = ctime(&current_time);
     24 
     25 	if (result == NULL) {
     26 		puts("Test FAILED: returned NULL");
     27 		return PTS_FAIL;
     28 	} else {
     29 		printf("converted date and time is: %s\n",
     30 		       ctime(&current_time));
     31 		printf("Test PASSED\n");
     32 		return PTS_PASS;
     33 	}
     34 }
     35