vpx_usec_timer_elapsed: use 64-bit math

this prevents a rollover when tv_sec is a long:
signed integer overflow: 2776 * 1000000 cannot be represented in type
'long'

Change-Id: I03dc4476ee122b02e2856dad28358a20cf16a9f8
This commit is contained in:
James Zern 2017-02-09 19:28:59 -08:00
parent c3f095c8b3
commit 943f9c0356

View File

@ -83,7 +83,7 @@ static INLINE int64_t vpx_usec_timer_elapsed(struct vpx_usec_timer *t) {
struct timeval diff; struct timeval diff;
timersub(&t->end, &t->begin, &diff); timersub(&t->end, &t->begin, &diff);
return diff.tv_sec * 1000000 + diff.tv_usec; return (int64_t)diff.tv_sec * 1000000 + diff.tv_usec;
#endif #endif
} }