Skip to content

Instantly share code, notes, and snippets.

@EggToaster
Last active May 17, 2024 08:30
Show Gist options
  • Save EggToaster/2f4984ed39dc7281d923cc7b340687df to your computer and use it in GitHub Desktop.
Save EggToaster/2f4984ed39dc7281d923cc7b340687df to your computer and use it in GitHub Desktop.
Get FreeSO time with Lua
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