summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2015-01-19 19:15:48 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2015-01-19 19:15:48 +0000
commit989a5da334aeb97177a1b1aeb300cf8b601f9b7c (patch)
treeda1a5c91238cb4dfd7b9a07f908f3f5675beef03
parent15537aa2af2dd52afdccafcbda1ce3bfd1f1657e (diff)
downloadnetsurf-989a5da334aeb97177a1b1aeb300cf8b601f9b7c.tar.gz
netsurf-989a5da334aeb97177a1b1aeb300cf8b601f9b7c.tar.bz2
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.
-rw-r--r--utils/log.c6
1 files 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;
}