From d167b58b244515d7dfd1421eaddcf1daae3ad7e6 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Sun, 9 Jun 2019 15:56:53 -0500 Subject: [PATCH] Better localize gettimeofday() call usage --- examples/cluster.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/cluster.c b/examples/cluster.c index 434f297..52e9b7c 100644 --- a/examples/cluster.c +++ b/examples/cluster.c @@ -124,13 +124,9 @@ int main(int argc, char **argv) { FD_SET(fd2, &rfds); while (1) { - struct timeval now; - int pending, nfds = fd2 + 1; - (void)gettimeofday(&now, NULL); - while ((pending = XPending(display)) != 0) { XEvent e; @@ -170,8 +166,12 @@ int main(int argc, char **argv) { case 0x288: case 0x320: case 0x5a0: { + struct timeval now; + cluster_update(&frame); + (void)gettimeofday(&now, NULL); + if (now.tv_sec - last.tv_sec || now.tv_usec - last.tv_usec > 16666) { hexagram_window_refresh_bg(window);