diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-03-24 07:37:31 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-03-24 07:37:31 +0100 |
| commit | cb839522902d3db508c34703a385baabfdd9baa5 (patch) | |
| tree | ffa401521f7aa069aeb6ba24419fe88d6692cf36 /wlock.c | |
| parent | 919fb8a75f14cb62c49844a656b060e109988218 (diff) | |
fix timer update bug
Diffstat (limited to 'wlock.c')
| -rw-r--r-- | wlock.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -460,10 +460,10 @@ main(int argc, char *argv[]) fds[2].fd = timerfd_create(CLOCK_MONOTONIC, 0); fds[2].events = POLLIN; - spec.it_interval.tv_sec = 1; - spec.it_value.tv_nsec = 1; + update_time(); + spec.it_value.tv_sec = 1; + spec.it_value.tv_nsec = 0; timerfd_settime(fds[2].fd, 0, &spec, 0); - spec.it_interval.tv_nsec = 0; while (running) { if (wl_display_flush(client.display) < 0) { @@ -493,6 +493,9 @@ main(int argc, char *argv[]) if (fds[2].revents & POLLIN) { update_time(); + spec.it_value.tv_sec = 1; + spec.it_value.tv_nsec = 0; + timerfd_settime(fds[2].fd, 0, &spec, 0); } } |