Advertisement
dannysmc95

Real Time (Supports Timezones)

Jun 16th, 2015
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. function irltimezones()
  2.     local req = http.post("https://ccsystems.dannysmc.com/ccsystems.php", "ccsys=misc&cccmd=irltimezones")
  3.     assert(type(req) == "table")
  4.     req = textutils.unserialize(req.readAll())
  5.     return req
  6. end
  7.  
  8. function locate()
  9.     local req = http.post("https://ccsystems.dannysmc.com/ccsystems.php", "ccsys=misc&cccmd=locate")
  10.     req = textutils.unserialize(req.readAll())
  11.     return req
  12. end
  13.  
  14. function irltime(zone)
  15.     if zone then
  16.         req = http.post("https://ccsystems.dannysmc.com/ccsystems.php", "ccsys=misc$cccmd=irltime&timezone="..textutils.urlEncode(tostring(zone)))
  17.     else
  18.         req = http.post("https://ccsystems.dannysmc.com/ccsystems.php", "ccsys=misc$cccmd=irltime")
  19.     end
  20.     assert(type(req) == "table")
  21.     req = textutils.unserialize(req.readAll())
  22.     return req
  23. end
  24.  
  25. function irltimeauto()
  26.     url = "https://ccsystems.dannysmc.com/ccsystems.php"
  27.     querystring = "ccsys=misc&cccmd=irltimeauto"
  28.     local req = http.post(url, querystring)
  29.     assert(type(req) == "table")
  30.     return textutils.unserialize(req.readAll())
  31. end
  32.  
  33. function irltimeasync(zone)
  34.     if zone then
  35.         req = http.request("https://ccsystems.dannysmc.com/ccsystems.php", "ccsys=misc$cccmd=irltime&timezone="..textutils.urlEncode(tostring(zone)))
  36.     else
  37.         req = http.request("https://ccsystems.dannysmc.com/ccsystems.php", "ccsys=misc$cccmd=irltime")
  38.     end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement