xref: /dpdk/lib/eal/freebsd/include/rte_os_shim.h (revision 1ee899977d701768f6437e2b178a06e46283f821)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 
3 #ifndef _RTE_OS_SHIM_
4 #define _RTE_OS_SHIM_
5 
6 #include <time.h>
7 
8 #include <rte_os.h>
9 
10 /**
11  * @file
12  * @internal
13  * Provides semi-standard OS facilities by convenient names.
14  */
15 
16 #ifndef TIME_UTC
17 
18 #define TIME_UTC 1
19 
20 static inline int
rte_timespec_get(struct timespec * now,int base)21 rte_timespec_get(struct timespec *now, int base)
22 {
23 	if (base != TIME_UTC || clock_gettime(CLOCK_REALTIME, now) < 0)
24 		return 0;
25 	return base;
26 }
27 
28 #define timespec_get(ts, base) rte_timespec_get(ts, base)
29 
30 #endif /* !defined TIME_UTC */
31 
32 #endif /* _RTE_OS_SHIM_ */
33