Updated stopwatch to show microsecond precision, works on linux

This commit is contained in:
Matthew Ellison
2019-02-06 02:00:24 -05:00
parent c1149d09a4
commit f9cce574cb

View File

@@ -1,7 +1,7 @@
--luaClasses/Stopwatch.lua
--Matthew Ellison
-- Created: 2-1-19
--Modified: 2-1-19
-- Created: 02-01-19
--Modified: 02-06-19
--This is a simple class to be used to time runtimes of various things within programs
Stopwatch = {
@@ -34,8 +34,12 @@ function Stopwatch:getTime()
return (self.stopTime - self.startTime)
end
function Stopwatch:getMicroseconds()
return math.floor(self:getTime() * 1000000)
end
function Stopwatch:getMilliseconds()
return math.floor((self:getTime() * 1000))
return (self:getTime() * 1000)
end
function Stopwatch:getSeconds()