diff options
author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-06-19 18:07:47 +0200 |
---|---|---|
committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-06-19 18:07:55 +0200 |
commit | 49948b4cc0f73d02a8932c525690a35e8efb6ac5 (patch) | |
tree | 1ee33d5393046939a37fdef00b3484e87ff3ec6d /include/ticker.h | |
parent | ead2881be92d33076c2104dbd75bad3561f26088 (diff) | |
download | silly_game-49948b4cc0f73d02a8932c525690a35e8efb6ac5.tar.xz |
add client
Signed-off-by: Lizzy Fleckenstein <lizzy@vlhl.dev>
Diffstat (limited to 'include/ticker.h')
-rw-r--r-- | include/ticker.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/ticker.h b/include/ticker.h new file mode 100644 index 0000000..f6387c4 --- /dev/null +++ b/include/ticker.h @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2024 Lizzy Fleckenstein <lizzy@vlhl.dev> +// +// SPDX-License-Identifier: AGPL-3.0-or-later + +#ifndef TICKER_H +#define TICKER_H + +#include <time.h> +#include <stdint.h> +#include <stdbool.h> + +#define NANOS 1000000000 + +typedef struct { + struct timespec timestamp; + uint64_t freq_nanos; +} ticker; + +void ticker_init(ticker *t, uint64_t f); +bool ticker_tick(ticker *t, uint64_t *dtime); +int ticker_timeout(ticker *t); + +#endif |