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 #include <zephyr/sys/timeutil.h> 15 16 /* arbitrary magic numbers used for testing */ 17 #define BIOS_FOOD 0xb105f00d 18 #define FORTY_TWO 42 19 #define SEVENTY_THREE 73 20 #define DONT_CARE 0x370ca2e5 21 timespec_add_ms(struct timespec * ts,uint32_t ms)22static inline void timespec_add_ms(struct timespec *ts, uint32_t ms) 23 { 24 struct timespec ms_as_ts = { 25 .tv_sec = ms / MSEC_PER_SEC, 26 .tv_nsec = (ms % MSEC_PER_SEC) * NSEC_PER_MSEC, 27 }; 28 29 (void)timespec_add(ts, &ms_as_ts); 30 } 31 32 #endif 33