1 /* 2 * Copyright (c) 2023, Meta 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef TESTS_LIB_CLIB_SRC_TEST_THRD_H_ 8 #define TESTS_LIB_CLIB_SRC_TEST_THRD_H_ 9 10 #include <stdint.h> 11 12 #include <zephyr/posix/time.h> 13 #include <zephyr/sys_clock.h> 14 15 /* arbitrary magic numbers used for testing */ 16 #define BIOS_FOOD 0xb105f00d 17 #define FORTY_TWO 42 18 #define SEVENTY_THREE 73 19 #define DONT_CARE 0x370ca2e5 20 timespec_add_ms(struct timespec * ts,uint32_t ms)21static inline void timespec_add_ms(struct timespec *ts, uint32_t ms) 22 { 23 bool oflow; 24 25 ts->tv_nsec += ms * NSEC_PER_MSEC; 26 oflow = ts->tv_nsec >= NSEC_PER_SEC; 27 ts->tv_sec += oflow; 28 ts->tv_nsec -= oflow * NSEC_PER_SEC; 29 } 30 31 #endif 32