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
This commit is contained in:
parent
23759f5ce4
commit
6f48f790d4
@ -238,21 +238,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user