Home | History | Annotate | Download | only in clock_gettime
      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_gettime() sets errno to EINVAL if clock_id does not
      9    specify a known clock.
     10  */
     11 #include <stdio.h>
     12 #include <time.h>
     13 #include <errno.h>
     14 #include "posixtest.h"
     15 
     16 #define INVALIDCLOCK 9999
     17 int main(void)
     18 {
     19 	struct timespec tp;
     20 
     21 	if (clock_gettime(INVALIDCLOCK, &tp) == -1) {
     22 		if (EINVAL == errno) {
     23 			printf("Test PASSED\n");
     24 			return PTS_PASS;
     25 		} else {
     26 			printf("errno not set to EINVAL\n");
     27 			printf("Test FAILED\n");
     28 			return PTS_FAIL;
     29 		}
     30 	}
     31 
     32 	printf("clock_gettime() did not return failure\n");
     33 	return PTS_UNRESOLVED;
     34 }
     35