package
0.0.0-20250120080617-bb7c638c6f78
Repository: https://github.com/chainreactors/mals.git
Documentation: pkg.go.dev
# README
time 
Usage
local time = require("time")
-- time.unix(), time.sleep()
local begin = time.unix()
time.sleep(1.2)
local stop = time.unix()
local result = stop - begin
result = math.floor(result * 10^2 + 0.5) / 10^2
if not(result == 1) then error("time.sleep()") end
-- time.parse(value, layout)
local result, err = time.parse("Dec 2 03:33:05 2018", "Jan 2 15:04:05 2006")
if err then error(err) end
if not(result == 1543721585) then error("time.parse()") end
-- time.format(value, layout, location)
local result, err = time.format(1543721585, "Jan 2 15:04:05 2006", "Europe/Moscow")
if err then error(err) end
if not(result == "Dec 2 06:33:05 2018") then error("time.format()") end
# Functions
Format lua time.format(unixts, ...layout, ...location) returns (string, err).
Loader is the module loader function.
Parse lua time.parse(value, layout, ...location) returns (number, error).
Preload adds time to the given Lua state's package.preload table.
Sleep lua time.sleep(number) port of go time.Sleep(int64).
Unix lua time.unix() returns unix timestamp in seconds (float).
UnixNano lua time.unix_nano() returns unix timestamp in nano seconds.