Home | History | Annotate | Download | only in clock_settime
      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  * Test that clock_settime() cannot set the monotonic clock CLOCK_MONOTONIC,
      9  * and will fail if invoked with clock CLOCK_MONOTONIC.
     10  *
     11  * The date chosen is Nov 12, 2002 ~11:13am.
     12  */
     13 #include <stdio.h>
     14 #include <time.h>
     15 #include "posixtest.h"
     16 
     17 #define TESTTIME 1037128358
     18 
     19 int main(void)
     20 {
     21 #ifdef CLOCK_MONOTONIC
     22 	struct timespec tpset;
     23 
     24 	tpset.tv_sec = TESTTIME;
     25 	tpset.tv_nsec = 0;
     26 	if (clock_settime(CLOCK_MONOTONIC, &tpset) == -1) {
     27 		printf("Test PASSED\n");
     28 		return PTS_PASS;
     29 	} else {
     30 		printf("clock_settime() did not fail with CLOCK_MONOTONIC\n");
     31 		return PTS_FAIL;
     32 	}
     33 
     34 	return PTS_UNRESOLVED;
     35 #else
     36 	printf("CLOCK_MONOTONIC not supported\n");
     37 	return PTS_UNSUPPORTED;
     38 #endif
     39 
     40 }
     41