1/*
2 * Copyright (c) 2002, Intel Corporation. All rights reserved.
3 * Created by:  bing.wei.liu 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 pthread_condattr_setclock()
9 *  shall set the 'clock' attribute in an initialized attributes object referenced by
10 *  'attr'.
11 *
12 * Steps:
13 * 1.  Initialize a pthread_condattr_t object
14 * 2.  Set the clock to CLOCK_REALTIME
15 * 3.  Check that it was set successfully
16 *
17 */
18
19# define _XOPEN_SOURCE  600
20
21#include <pthread.h>
22#include <stdio.h>
23#include "posixtest.h"
24
25int main()
26{
27	pthread_condattr_t condattr;
28	int rc;
29
30	/* Initialize a cond attributes object */
31	if((rc=pthread_condattr_init(&condattr)) != 0)
32	{
33		fprintf(stderr,"Error at pthread_condattr_init(), rc=%d\n",rc);
34		printf("Test FAILED\n");
35		return PTS_FAIL;
36	}
37
38	rc = pthread_condattr_setclock(&condattr, CLOCK_REALTIME);
39	if(rc != 0)
40	{
41		printf("Test FAILED: Could not set clock to CLOCK_REALTIME\n");
42		return PTS_FAIL;
43	}
44
45	printf("Test PASSED\n");
46	return PTS_PASS;
47}
48