1 /* SPDX-License-Identifier: GPL-2.0-or-later 2 * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz> 3 */ 4 5 /* 6 * clock_gettime() and clock_getres() functions 7 */ 8 9 #ifndef TST_CLOCKS__ 10 #define TST_CLOCKS__ 11 12 int tst_clock_getres(clockid_t clk_id, struct timespec *res); 13 14 int tst_clock_gettime(clockid_t clk_id, struct timespec *ts); 15 16 int tst_clock_settime(clockid_t clk_id, struct timespec *ts); 17 18 /* 19 * Converts clock id to a readable name. 20 */ 21 const char *tst_clock_name(clockid_t clk_id); 22 23 /* 24 * Returns current system time for file/IPC operations, which may slightly lag 25 * behind time() return values. 26 * 27 * The reason for this is that the time() syscall reads the nanosecond timer at 28 * the time of the call and adds it to the kernel current time, because of that 29 * accumulation may cause it jump one second ahead compared to the kernel time 30 * stamp that is used for IPC and filesystems. 31 */ 32 time_t tst_get_fs_timestamp(void); 33 34 #endif /* TST_CLOCKS__ */ 35