fixed clock timing when animation is turned off

This commit is contained in:
SpaghettiBorgar 2022-11-18 20:59:15 +01:00
parent 13ca5d4a0a
commit 47354ec369
1 changed files with 5 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#include <stdio.h> #include <stdio.h>
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>
#include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
@ -210,6 +211,10 @@ int main(int argc, char** argv)
if (config.animate) { if (config.animate) {
error = tb_peek_event(&event, config.min_refresh_delta); error = tb_peek_event(&event, config.min_refresh_delta);
} else if (config.clock) {
struct timeval tv;
gettimeofday(&tv, NULL);
error = tb_peek_event(&event, (60 - tv.tv_sec % 60) * 1000 - tv.tv_usec / 1000);
} else { } else {
error = tb_poll_event(&event); error = tb_poll_event(&event);
} }