os.time() - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: os.time() (/showthread.php?tid=1772) |
os.time() - AlexLV - 04.12.2018 Hello, can't find correct answer, think LUA guru can help.. now = os.time() returns me 1543929730 How correct understand this value? How convert to normal time? (hours, minutes, seconds, milliseconds?) If I want to work with minutes, or seconds, how convert this value? Is it UNIX time stamp? Please explain a little, need to use in different timers. Sorry for basic questions just learning LUA. RE: os.time() - admin - 04.12.2018 It is UNIX timestamp, number of seconds from January 1st, 1970. You can use os.date(fmt, time) to convert to human-readable date. If you need a relative value (hours, minutes etc between two timestamps) then you need to convert manually using / and % math operators. RE: os.time() - AlexLV - 04.12.2018 Ok, thanks, will study more deeply. RE: os.time() - Zen - 10.03.2023 (04.12.2018, 13:50)admin Wrote: It is UNIX timestamp, number of seconds from January 1st, 1970. You can use os.date(fmt, time) to convert to human-readable date. If you need a relative value (hours, minutes etc between two timestamps) then you need to convert manually using / and % math operators. Hi admin, is there any way to get UNIX 13-digit timestamp rather than the 10-digit? RE: os.time() - Erwin van der Zwart - 11.03.2023 I assume you need this: os.microtime() RE: os.time() - Zen - 11.03.2023 (11.03.2023, 07:25)Erwin van der Zwart Wrote: I assume you need this: os.microtime() No sir, it produce the same result Code: Code: -- os.time() -- 10-digit timestamp Result: Code: os time 13-digit try 11.03.2023 18:45:48 RE: os.time() - admin - 13.03.2023 Use this: Code: tsec, tusec = os.microtime() RE: os.time() - Zen - 13.03.2023 (13.03.2023, 07:48)admin Wrote: Use this: It worked, thanks |