diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-06-09 02:40:55 -0700 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-06-09 02:40:55 -0700 |
commit | 32b7ab871a07f20c73187a577dedb737cc8b18fd (patch) | |
tree | 3ccabaa43445a099852e45add9fa93574fab59bb /lualibs-os.lua | |
parent | ec6ddd136a1364a5c55e611cf6098c165b383ec0 (diff) | |
parent | 40cf2319dbf8b2d6796c7941a31795cd2cb55eb3 (diff) | |
download | lualibs-32b7ab871a07f20c73187a577dedb737cc8b18fd.tar.gz |
Merge pull request #14 from phi-gamma/master
sync
Diffstat (limited to 'lualibs-os.lua')
-rw-r--r-- | lualibs-os.lua | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lualibs-os.lua b/lualibs-os.lua index 05ca0ac..a4c0ac8 100644 --- a/lualibs-os.lua +++ b/lualibs-os.lua @@ -172,19 +172,21 @@ if not os.times then -- ? end end -os.gettimeofday = os.gettimeofday or os.clock -local startuptime = os.gettimeofday() +local gettimeofday = os.gettimeofday or os.clock +os.gettimeofday = gettimeofday + +local startuptime = gettimeofday() function os.runtime() - return os.gettimeofday() - startuptime + return gettimeofday() - startuptime end ---~ print(os.gettimeofday()-os.time()) ---~ os.sleep(1.234) ---~ print (">>",os.runtime()) ---~ print(os.date("%H:%M:%S",os.gettimeofday())) ---~ print(os.date("%H:%M:%S",os.time())) +-- print(os.gettimeofday()-os.time()) +-- os.sleep(1.234) +-- print (">>",os.runtime()) +-- print(os.date("%H:%M:%S",os.gettimeofday())) +-- print(os.date("%H:%M:%S",os.time())) -- no need for function anymore as we have more clever code and helpers now -- this metatable trickery might as well disappear |