Last active
May 17, 2024 08:30
-
-
Save EggToaster/2f4984ed39dc7281d923cc7b340687df to your computer and use it in GitHub Desktop.
Get FreeSO time with Lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local m = os.date("!%M") -- UTC minutes | |
local s = os.date("!%S") -- UTC seconds | |
s = m * 60 + s -- combining seconds and minutes | |
local h = math.floor(s / 300) -- freeso hour calculation | |
if h == 0 then -- 0:xx to 24:xx | |
h = 24 | |
end | |
m = math.floor(s % 300 / 5) -- freeso minutes calculation | |
if m < 10 then -- x to 0x, or 5 to 05 | |
m = "0" .. m | |
end | |
print(h..":"..m) -- result will always be xx:xx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment