mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #3243
2bc8c3db
epee get_ns_count: cast to uint64_t before multiplying 10^9 to avoid overflow (stoffu)
This commit is contained in:
commit
e3ad0c9ca6
1 changed files with 2 additions and 2 deletions
|
@ -75,13 +75,13 @@ namespace misc_utils
|
||||||
clock_get_time(cclock, &mts);
|
clock_get_time(cclock, &mts);
|
||||||
mach_port_deallocate(mach_task_self(), cclock);
|
mach_port_deallocate(mach_task_self(), cclock);
|
||||||
|
|
||||||
return (mts.tv_sec * 1000000000) + (mts.tv_nsec);
|
return ((uint64_t)mts.tv_sec * 1000000000) + (mts.tv_nsec);
|
||||||
#else
|
#else
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
if(clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
|
if(clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (ts.tv_sec * 1000000000) + (ts.tv_nsec);
|
return ((uint64_t)ts.tv_sec * 1000000000) + (ts.tv_nsec);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue