summaryrefslogtreecommitdiff
path: root/src/lib/time_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/time_utils.c')
-rw-r--r--src/lib/time_utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/time_utils.c b/src/lib/time_utils.c
index b34e4763..4da935c4 100644
--- a/src/lib/time_utils.c
+++ b/src/lib/time_utils.c
@@ -39,7 +39,7 @@ int ts_add(const struct timespec * t,
nanos = t->tv_nsec + intv->tv_nsec;
res->tv_sec = t->tv_sec + intv->tv_sec;
- while (nanos > BILLION) {
+ while (nanos >= BILLION) {
nanos -= BILLION;
++(res->tv_sec);
}
@@ -85,7 +85,7 @@ int tv_add(const struct timeval * t,
micros = t->tv_usec + intv->tv_usec;
res->tv_sec = t->tv_sec + intv->tv_sec;
- while (micros > MILLION) {
+ while (micros >= MILLION) {
micros -= MILLION;
--(res->tv_sec);
}