1 /*
2  * Copyright (c) 2022 Meta
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "_common.h"
8 
9 #ifdef CONFIG_POSIX_API
10 #include <sys/time.h>
11 #else
12 #include <zephyr/posix/sys/time.h>
13 #endif
14 
15 /**
16  * @brief existence test for `<sys/time.h>`
17  *
18  * @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_time.h.html">sys/time.h</a>
19  */
ZTEST(posix_headers,test_sys_time_h)20 ZTEST(posix_headers, test_sys_time_h)
21 {
22 	zassert_not_equal(-1, offsetof(struct timeval, tv_sec));
23 	zassert_not_equal(-1, offsetof(struct timeval, tv_usec));
24 
25 	/* zassert_not_equal(-1, offsetof(struct itimerval, it_interval)); */ /* not implemented */
26 	/* zassert_not_equal(-1, offsetof(struct itimerval, it_value)); */ /* not implemented */
27 
28 	/* zassert_not_equal(-1, ITIMER_REAL); */ /* not implemented */
29 	/* zassert_not_equal(-1, ITIMER_VIRTUAL); */ /* not implemented */
30 	/* zassert_not_equal(-1, ITIMER_PROF); */ /* not implemented */
31 
32 	if (IS_ENABLED(CONFIG_POSIX_API)) {
33 		/* zassert_not_null(getitimer); */ /* not implemented */
34 		zassert_not_null(gettimeofday);
35 		/* zassert_not_null(setitimer); */ /* not implemented */
36 		/* zassert_not_null(utimes); */ /* not implemented */
37 	}
38 }
39