Home | History | Annotate | Download | only in strftime
      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  * strftime shall return the number of bytes placed into the array.
     10  * Otherwise, it should return 0.
     11  */
     12 
     13 #include <time.h>
     14 #include <stdio.h>
     15 #include "posixtest.h"
     16 
     17 int main(void)
     18 {
     19 	struct tm *tm_ptr;
     20 	time_t the_time;
     21 	char buf[256];
     22 	int result;
     23 
     24 	(void)time(&the_time);
     25 	tm_ptr = localtime(&the_time);
     26 	result = strftime(buf, sizeof(buf), "%A %d %B, %I:%S %p", tm_ptr);
     27 
     28 	if (result != 0) {
     29 		printf("strftime gives: %s\n", buf);
     30 		puts("PASS");
     31 		return PTS_PASS;
     32 	} else {
     33 		puts("FAIL");
     34 		return PTS_FAIL;
     35 	}
     36 }
     37