Lely core libraries  2.2.5
clock.h
Go to the documentation of this file.
1 
25 #ifndef LELY_IO2_CLOCK_H_
26 #define LELY_IO2_CLOCK_H_
27 
28 #include <lely/libc/time.h>
29 #include <lely/io2/io2.h>
30 
31 #ifndef LELY_IO_CLOCK_INLINE
32 #define LELY_IO_CLOCK_INLINE static inline
33 #endif
34 
36 typedef const struct io_clock_vtbl *const io_clock_t;
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 struct io_clock_vtbl {
43  int (*getres)(const io_clock_t *clock, struct timespec *res);
44  int (*gettime)(const io_clock_t *clock, struct timespec *tp);
45  int (*settime)(io_clock_t *clock, const struct timespec *tp);
46 };
47 
59 LELY_IO_CLOCK_INLINE int io_clock_getres(
60  const io_clock_t *clock, struct timespec *res);
61 
71 LELY_IO_CLOCK_INLINE int io_clock_gettime(
72  const io_clock_t *clock, struct timespec *tp);
73 
86 LELY_IO_CLOCK_INLINE int io_clock_settime(
87  io_clock_t *clock, const struct timespec *tp);
88 
89 inline int
90 io_clock_getres(const io_clock_t *clock, struct timespec *res)
91 {
92  return (*clock)->getres(clock, res);
93 }
94 
95 inline int
96 io_clock_gettime(const io_clock_t *clock, struct timespec *tp)
97 {
98  return (*clock)->gettime(clock, tp);
99 }
100 
101 inline int
102 io_clock_settime(io_clock_t *clock, const struct timespec *tp)
103 {
104  return (*clock)->settime(clock, tp);
105 }
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif // !LELY_IO2_CLOCK_H_
int io_clock_settime(io_clock_t *clock, const struct timespec *tp)
Sets the time value of the specified clock.
Definition: clock.h:102
int io_clock_gettime(const io_clock_t *clock, struct timespec *tp)
Obtains the current time value of the specified clock.
Definition: clock.h:96
int io_clock_getres(const io_clock_t *clock, struct timespec *res)
Obtains the resolution of the specified clock.
Definition: clock.h:90
const struct io_clock_vtbl *const io_clock_t
An abstract clock.
Definition: clock.h:36
This is the public header file of the I/O library.
This header file is part of the C11 and POSIX compatibility library; it includes <time....