forked from acouzens/open5gs
[core] fix timer overflow on 32bit systems (#16)
must cast ts.tv_sec to 64bits before we multiply it to prevent 32bit math and overflow
This commit is contained in:
parent
724fa56843
commit
0759c2da5a
|
@ -242,7 +242,7 @@ ogs_time_t ogs_get_monotonic_time(void)
|
|||
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return ((ts.tv_sec * 1000000UL) + (ts.tv_nsec / 1000UL));
|
||||
return (((int64_t) ts.tv_sec * 1000000UL) + (ts.tv_nsec / 1000UL));
|
||||
#elif defined(__APPLE__)
|
||||
static mach_timebase_info_data_t info = {0};
|
||||
static double ratio = 0.0;
|
||||
|
|
Loading…
Reference in New Issue