Don't trt yo be smart with the comma operator

This commit is contained in:
Nils O. Selåsdal
2013-07-01 23:00:19 +02:00
parent bf9802e565
commit 764dfc563c
+8 -4
View File
@@ -6,8 +6,10 @@ uc_tvadd(struct timeval *dst, const struct timeval *a, const struct timeval *b)
dst->tv_sec = a->tv_sec + b->tv_sec;
dst->tv_usec = a->tv_usec + b->tv_usec;
if (dst->tv_usec >= 1000000)
dst->tv_sec++, dst->tv_usec -= 1000000;
if (dst->tv_usec >= 1000000) {
dst->tv_sec++;
dst->tv_usec -= 1000000;
}
return dst;
}
@@ -18,8 +20,10 @@ uc_tvsub(struct timeval *dst, const struct timeval *a, const struct timeval *b)
dst->tv_sec = a->tv_sec - b->tv_sec;
dst->tv_usec = a->tv_usec - b->tv_usec;
if (dst->tv_usec < 0)
dst->tv_sec--, dst->tv_usec += 1000000;
if (dst->tv_usec < 0) {
dst->tv_sec--;
dst->tv_usec += 1000000;
}
return dst;
}