summaryrefslogtreecommitdiff
path: root/include/asterisk/time.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asterisk/time.h')
-rw-r--r--include/asterisk/time.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/asterisk/time.h b/include/asterisk/time.h
index c78ff2db0..4fa08723b 100644
--- a/include/asterisk/time.h
+++ b/include/asterisk/time.h
@@ -83,8 +83,9 @@ int64_t ast_tvdiff_ms(struct timeval end, struct timeval start),
is handled for positive and negative numbers, by ensuring
that the divisor is always positive
*/
- return ((end.tv_sec - start.tv_sec) * 1000) +
- (((1000000 + end.tv_usec - start.tv_usec) / 1000) - 1000);
+ int64_t sec_dif = (int64_t)(end.tv_sec - start.tv_sec) * 1000;
+ int64_t usec_dif = (1000000 + end.tv_usec - start.tv_usec) / 1000 - 1000;
+ return sec_dif + usec_dif;
}
)