os.epoch

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

ExampleGet 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
<nowiki>
local epoch = os.epoch("utc")
print("Current Unix epoch in seconds: " .. epoch / 1000) -- division by thousand to convert milliseconds to seconds
  </nowiki>
Output Current Unix epoch in seconds: 1533874800

os.epoch
Function
Syntax
os.epoch(
  • source : string
)

Returns number
API os
Source CC:Tweaked (source)
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.