Slap u64 on everything time-y

* get_us_time() will overflow and reset to zero every now and then.
  Had it happen several times in one day,
  https://github.com/minetest/minetest/issues/10105
* backported b5eda416ce
stable-5.2-namespace
mckaygerhard 2023-09-17 15:07:09 -04:00
parent f0cea26ac5
commit 2af5896ed1
1 changed files with 3 additions and 3 deletions

View File

@ -234,21 +234,21 @@ inline u64 getTimeMs()
{
struct timespec ts;
os_get_clock(&ts);
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
return ((u64) ts.tv_sec) * 1000LL + ((u64) ts.tv_nsec) / 1000000LL;
}
inline u64 getTimeUs()
{
struct timespec ts;
os_get_clock(&ts);
return ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
return ((u64) ts.tv_sec) * 1000000LL + ((u64) ts.tv_nsec) / 1000LL;
}
inline u64 getTimeNs()
{
struct timespec ts;
os_get_clock(&ts);
return ts.tv_sec * 1000000000 + ts.tv_nsec;
return ((u64) ts.tv_sec) * 1000000000LL + ((u64) ts.tv_nsec);
}
#endif