mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-16 09:12:44 +03:00
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.
This commit is contained in:
parent
15537aa2af
commit
989a5da334
@ -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. */
|
/* Perform the carry for the later subtraction by updating y. */
|
||||||
if (x->tv_usec < y->tv_usec) {
|
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_usec -= 1000000 * nsec;
|
||||||
y->tv_sec += nsec;
|
y->tv_sec += nsec;
|
||||||
}
|
}
|
||||||
if (x->tv_usec - y->tv_usec > 1000000) {
|
if ((int)(x->tv_usec - y->tv_usec) > 1000000) {
|
||||||
int nsec = (x->tv_usec - y->tv_usec) / 1000000;
|
int nsec = (int)(x->tv_usec - y->tv_usec) / 1000000;
|
||||||
y->tv_usec += 1000000 * nsec;
|
y->tv_usec += 1000000 * nsec;
|
||||||
y->tv_sec -= nsec;
|
y->tv_sec -= nsec;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user