os.epoch

From ComputerCraft
Jump to: navigation, search

os.epoch
Function
Syntax
os.epoch()
Returns number
API os
Source CC:Tweaked (source)

Returns the current Unix epoch or the in-game epoch in milliseconds. Valid arguments for source are "utc", "local", and "ingame".

ExampleExampleGet the current Unix epoch in seconds (UTC)
Gets the current Unix epoch, then prints it out while dividing the epoch by 1000, to convert milliseconds to seconds.
Code
local epoch = os.epoch("utc")
print("Current Unix epoch in seconds: " .. epoch / 1000) -- division by thousand to convert milliseconds to seconds
Output Current Unix epoch in seconds: 1533874800