From 989a5da334aeb97177a1b1aeb300cf8b601f9b7c Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 19 Jan 2015 19:15:48 +0000 Subject: [PATCH] Cast timeval.usec calculations to int as AmigaOS3 has some conflicting headers which means it can be treated as an unsigned value. This ensures the log time is always correct. --- utils/log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/log.c b/utils/log.c index 8ec42c1f7..0be8ea264 100644 --- a/utils/log.c +++ b/utils/log.c @@ -70,12 +70,12 @@ timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y) { /* Perform the carry for the later subtraction by updating y. */ if (x->tv_usec < y->tv_usec) { - int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; + int nsec = (int)(y->tv_usec - x->tv_usec) / 1000000 + 1; y->tv_usec -= 1000000 * nsec; y->tv_sec += nsec; } - if (x->tv_usec - y->tv_usec > 1000000) { - int nsec = (x->tv_usec - y->tv_usec) / 1000000; + if ((int)(x->tv_usec - y->tv_usec) > 1000000) { + int nsec = (int)(x->tv_usec - y->tv_usec) / 1000000; y->tv_usec += 1000000 * nsec; y->tv_sec -= nsec; }