summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2024-11-19 23:43:46 -0800
committerVito Caputo <vcaputo@pengaru.com>2024-11-20 08:11:14 -0800
commit73367b12eda9bed587882ad8ec9cc6875a4c2bbc (patch)
treeeeccaeb15441dff735b3242e97399212eebf99a3
parentd202b2472e10850eadbf2f10a9b5a635a267a8ce (diff)
vcr: fix us->timespec conversion math typo
An extra 0 snuck in here and got copy and pasted too, oof.
-rw-r--r--src/vcr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vcr.c b/src/vcr.c
index 236ed21..fe13292 100644
--- a/src/vcr.c
+++ b/src/vcr.c
@@ -74,6 +74,8 @@
#include "util.h"
#include "vcr.h"
+#define VCR_USECS_PER_SECOND 1000000
+
/* backend is the root vcr object everything else here derives from,
* for an X backend it encompasses the xserver/display connection.
*/
@@ -417,7 +419,7 @@ int vcr_backend_get_dimensions(vcr_backend_t *vbe, int *res_width, int *res_heig
/* this is basically just needed by the vmon use case */
-/* returns 1 if the backend has events to process, 0 on timeout/error. */
+/* returns 1 if the backend has events to process, 0 on timeout, -1 on error. */
int vcr_backend_poll(vcr_backend_t *vbe, int timeout_us)
{
struct timespec ts, *pto = NULL;
@@ -427,8 +429,8 @@ int vcr_backend_poll(vcr_backend_t *vbe, int timeout_us)
/* TODO: keep signals blocked outside of ppoll() */
if (timeout_us >= 0) {
- ts.tv_sec = timeout_us / 10000000;
- ts.tv_nsec = (timeout_us - (ts.tv_sec * 10000000)) * 1000;
+ ts.tv_sec = timeout_us / VCR_USECS_PER_SECOND;
+ ts.tv_nsec = (timeout_us - (ts.tv_sec * VCR_USECS_PER_SECOND)) * 1000;
pto = &ts;
}
© All Rights Reserved