os.epoch
Returns the current Unix epoch or the in-game epoch in milliseconds. Valid arguments for source are "utc"
, "local"
, and "ingame"
.
|
|||
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 |
Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lua |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CC:Tweaked |
|
os.epoch Function | |
---|---|
Syntax os.epoch(
| |
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.