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_nanosleep() sets errno to EINVAL if clock_id does 9 * not refer to a known clock. 10 */ 11 #include <stdio.h> 12 #include <time.h> 13 #include <errno.h> 14 #include "posixtest.h" 15 16 #define SLEEPSEC 4 17 18 #define BOGUSCLOCKID 99999 19 20 int main(void) 21 { 22 struct timespec tssleep; 23 24 tssleep.tv_sec = SLEEPSEC; 25 tssleep.tv_nsec = 0; 26 27 if (clock_nanosleep(BOGUSCLOCKID, 0, &tssleep, NULL) == EINVAL) { 28 printf("Test PASSED\n"); 29 return PTS_PASS; 30 } 31 32 printf("errno != EINVAL\n"); 33 return PTS_FAIL; 34 } 35