lin
2025-08-14 dae8bad597b6607a449b32bf76c523423f7720ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-License-Identifier: GPL-2.0 or later
/*
 *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
 *  Email : code@zilogic.com
 */
 
#include <time.h>
#include "tst_test.h"
 
static inline void safe_clock_getres(const char *file, const int lineno,
   clockid_t clk_id, struct timespec *res)
{
   int rval;
 
   rval = clock_getres(clk_id, res);
   if (rval != 0)
       tst_brk(TBROK | TERRNO,
           "%s:%d clock_getres() failed", file, lineno);
 
}
 
static inline void safe_clock_gettime(const char *file, const int lineno,
   clockid_t clk_id, struct timespec *tp)
{
   int rval;
 
   rval = clock_gettime(clk_id, tp);
   if (rval != 0)
       tst_brk(TBROK | TERRNO,
           "%s:%d clock_gettime() failed", file, lineno);
}
 
#define SAFE_CLOCK_GETRES(clk_id, res)\
   safe_clock_getres(__FILE__, __LINE__, (clk_id), (res))
 
#define SAFE_CLOCK_GETTIME(clk_id, tp)\
   safe_clock_gettime(__FILE__, __LINE__, (clk_id), (tp))