Lely core libraries 2.3.4
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/io2/io2.h>
29#include <lely/libc/time.h>
30
31#ifndef LELY_IO_CLOCK_INLINE
32#define LELY_IO_CLOCK_INLINE static inline
33#endif
34
36typedef const struct io_clock_vtbl *const io_clock_t;
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
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
59LELY_IO_CLOCK_INLINE int io_clock_getres(
60 const io_clock_t *clock, struct timespec *res);
61
71LELY_IO_CLOCK_INLINE int io_clock_gettime(
72 const io_clock_t *clock, struct timespec *tp);
73
86LELY_IO_CLOCK_INLINE int io_clock_settime(
87 io_clock_t *clock, const struct timespec *tp);
88
89inline int
90io_clock_getres(const io_clock_t *clock, struct timespec *res)
91{
92 return (*clock)->getres(clock, res);
93}
94
95inline int
96io_clock_gettime(const io_clock_t *clock, struct timespec *tp)
97{
98 return (*clock)->gettime(clock, tp);
99}
100
101inline int
102io_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....
A time type with nanosecond resolution.
Definition time.h:88