Home | History | Annotate | Download | only in clock
      1 /*
      2  * Copyright (c) 2002, Intel Corporation. All rights reserved.
      3  * Created by:  julie.n.fleischer 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  * @pt:XSI
      9  * Test that CLOCKS_PER_SEC == 1,000,000 in <time.h>
     10  */
     11 
     12 // Applied patch from Craig Rodrigues; no longer assumes CLOCKS_PER_SEC is long
     13 // 12-18-02 Per suggestion by neal REMOVE-THIS AT cs DOT uml DOT edu started
     14 // using intmax_h and INTMAX_C.  Also added use of PRIdMAX per his suggestion.
     15 
     16 #include <time.h>
     17 #include <stdio.h>
     18 #include <stdint.h>
     19 #include <inttypes.h>
     20 #include "posixtest.h"
     21 
     22 #define EXPECTEDVALUE INTMAX_C(1000000)
     23 
     24 int main(void)
     25 {
     26 	intmax_t clocks_per_sec = (intmax_t) CLOCKS_PER_SEC;
     27 
     28 	if (EXPECTEDVALUE == CLOCKS_PER_SEC) {
     29 		printf("Test PASSED\n");
     30 		return PTS_PASS;
     31 	} else {
     32 		printf("FAIL:  %" PRIdMAX " != %" PRIdMAX "\n",
     33 		       clocks_per_sec, EXPECTEDVALUE);
     34 		return PTS_FAIL;
     35 	}
     36 
     37 	return PTS_UNRESOLVED;
     38 }
     39