-
Notifications
You must be signed in to change notification settings - Fork 0
/
13-1.c
43 lines (34 loc) · 965 Bytes
/
13-1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Copyright (c) 2002, Intel Corporation. All rights reserved.
* Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
* Test that clock_nanosleep() sets errno to EINVAL if clock_id does
* not refer to a known clock.
*/
#include <stdio.h>
#include <time.h>
#include <errno.h>
#include "posixtest.h"
#if __APPLE__
int main() { return 0; }
#else /* !__APPLE__ */
#define SLEEPSEC 4
#define BOGUSCLOCKID 99999
int main(int argc, char *argv[])
{
struct timespec tssleep;
tssleep.tv_sec=SLEEPSEC;
tssleep.tv_nsec=0;
if (clock_nanosleep(BOGUSCLOCKID, 0, &tssleep, NULL) == EINVAL) {
printf("Test PASSED\n");
return PTS_PASS;
} else {
printf("errno != EINVAL\n");
return PTS_FAIL;
}
printf("This code should not be executed\n");
return PTS_UNRESOLVED;
}
#endif /* !__APPLE__ */