use round() for rounding

Replace casting of values incremented by +0.5/-0.5 with round().
This commit is contained in:
Miroslav Lichvar
2021-09-23 10:01:50 +02:00
parent 9600993c28
commit d0d9a3fa43
4 changed files with 4 additions and 22 deletions

2
util.c
View File

@@ -123,7 +123,7 @@ UTI_DoubleToTimeval(double a, struct timeval *b)
b->tv_sec = a;
frac_part = 1.0e6 * (a - b->tv_sec);
b->tv_usec = frac_part > 0 ? frac_part + 0.5 : frac_part - 0.5;
b->tv_usec = round(frac_part);
UTI_NormaliseTimeval(b);
}