Advertisement
vlatkovski

time testing

Mar 3rd, 2015
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. -- credits to nolicaiks for something
  2.  
  3. function getTime(root)
  4.     local time = tonumber((root and (type(root)=="function" and root()) or ((type(root)=="string" or type(root)=="number") and tonumber(root))) or (tick and tick()) or (os.time()) );
  5.     local secs = math.floor(time % 60);
  6.     local mins = math.floor(time / 60 % 60);
  7.     local hours = math.floor(time / 3600 % 24);
  8.     return string.format("%02i:%02i:%02i", hours, mins, secs);
  9. end;
  10.  
  11. print("global: "..getTime(os.time));
  12. print("local: "..getTime(tick));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement