From 31d448971aa992c75ee4d79d73e985f36927ce25 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sat, 8 Jan 2022 12:59:15 -0500 Subject: [PATCH] Restored floating point time granularity. --- data/core/init.lua | 4 ++-- src/api/system.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/core/init.lua b/data/core/init.lua index c76c6366..446d6b20 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -779,8 +779,8 @@ function core.confirm_close_docs(docs, close_fn, ...) end end -local temp_uid = (system.get_time() * 1000) % 0xffffffff -local temp_file_prefix = string.format(".lite_temp_%08x", temp_uid) +local temp_uid = math.floor(system.get_time() * 1000) % 0xffffffff +local temp_file_prefix = string.format(".lite_temp_%08x", tonumber(temp_uid)) local temp_file_counter = 0 local function delete_temp_files() diff --git a/src/api/system.c b/src/api/system.c index 13fd29aa..8abc5595 100644 --- a/src/api/system.c +++ b/src/api/system.c @@ -639,7 +639,7 @@ static int f_set_clipboard(lua_State *L) { static int f_get_time(lua_State *L) { double n = SDL_GetPerformanceCounter() / (double) SDL_GetPerformanceFrequency(); - lua_pushinteger(L, n); + lua_pushnumber(L, n); return 1; }