Compare commits

...

2 Commits

Author SHA1 Message Date
3cb2d2e237 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
2023-09-17 15:35:12 -04:00
e99363e4e9 pkgmgr: Fix crash when .conf release field is invalid 2023-09-17 15:35:03 -04:00
2 changed files with 5 additions and 5 deletions

View File

@ -51,7 +51,7 @@ function get_mods(path,retval,modpack)
-- Read from config
toadd.name = name
toadd.author = mod_conf.author
toadd.release = tonumber(mod_conf.release or "0")
toadd.release = tonumber(mod_conf.release or 0)
toadd.path = prefix
toadd.type = "mod"
@ -99,7 +99,7 @@ function pkgmgr.get_texture_packs()
retval[#retval + 1] = {
name = item,
author = conf:get("author"),
release = tonumber(conf:get("release") or "0"),
release = tonumber(conf:get("release") or 0),
list_name = name,
type = "txp",
path = path,

View File

@ -237,21 +237,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