diff options
| author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2026-04-12 21:23:36 +0200 |
|---|---|---|
| committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2026-04-12 21:23:36 +0200 |
| commit | 171ee405f9e4a390fb760b72daa9ff8015c89e2a (patch) | |
| tree | a40f1ab50304338e06d8c982bdc47b55b8c33d09 /src | |
| parent | e5af28536bfb0f4c9131df56d2009ba5196f5e3a (diff) | |
| download | animtool-171ee405f9e4a390fb760b72daa9ff8015c89e2a.tar.xz | |
fix standard compliance issues
Diffstat (limited to 'src')
| -rw-r--r-- | src/fmt/nut.c | 1 | ||||
| -rw-r--r-- | src/render.c | 9 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/fmt/nut.c b/src/fmt/nut.c index 99f9a69..f9ca9fd 100644 --- a/src/fmt/nut.c +++ b/src/fmt/nut.c @@ -1,3 +1,4 @@ +#define _DEFAULT_SOURCE // can be removed once glibc knows about <endian.h> in POSIX 2024 #include <stdio.h> #include <stdlib.h> #include <stdbit.h> diff --git a/src/render.c b/src/render.c index 9c7d796..fd88278 100644 --- a/src/render.c +++ b/src/render.c @@ -146,8 +146,13 @@ static void render_seq(size_t n_inst, struct seq_inst inst[n_inst], struct scene (ts_now.tv_nsec - state->start_ts.tv_nsec) / 1000000000.0 + (ts_now.tv_sec - state->start_ts.tv_sec); double ahead = time - e_time - scene->live.data; - if (ahead > 0.0) - usleep(ahead * 1000000.0); + if (ahead > 0.0) { + uint64_t nanos = ahead * 1000000000.0; + struct timespec ts_sleep; + ts_sleep.tv_nsec = nanos % 1000000000; + ts_sleep.tv_sec = nanos / 1000000000; + nanosleep(&ts_sleep, nullptr); + } } struct draw_frame frame; |
