| 1 | #include "pthread_impl.h" |
| 2 | |
| 3 | #ifndef __wasilibc_unmodified_upstream |
| 4 | #include <common/clock.h> |
| 5 | #endif |
| 6 | |
| 7 | int pthread_condattr_setclock(pthread_condattr_t *a, clockid_t clk) |
| 8 | { |
| 9 | #ifdef __wasilibc_unmodified_upstream |
| 10 | 	if (clk < 0 || clk-2U < 2) return EINVAL; |
| 11 | #else |
| 12 | 	if (clk->id < 0 || clk->id-2U < 2) return EINVAL; |
| 13 | #endif |
| 14 | 	a->__attr &= 0x80000000; |
| 15 | #ifdef __wasilibc_unmodified_upstream |
| 16 | 	a->__attr |= clk; |
| 17 | #else |
| 18 | 	a->__attr |= clk->id; |
| 19 | #endif |
| 20 | 	return 0; |
| 21 | } |