Advertisement
eytixis

time library (opencomputers mod)

Nov 8th, 2020
975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.37 KB | None | 0 0
  1. local timelib = {}
  2. local fs = require("filesystem")
  3.  
  4. function timelib.getDate(format)
  5.     if not fs.get("/").isReadOnly() then
  6.         local time = io.open("/tmp/.time", "w")
  7.         time:write()
  8.         time:close()
  9.         os.sleep(0.01)
  10.         return os.date(format, fs.lastModified("/tmp/.time") / 1002.7)
  11.     else
  12.         return nil
  13.     end
  14. end
  15.  
  16. return timelib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement