mirror of
https://bitbucket.org/Mattrixwv/luaclasses.git
synced 2025-12-06 18:33:59 -05:00
Updated stopwatch to show microsecond precision, works on linux
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
--luaClasses/Stopwatch.lua
|
--luaClasses/Stopwatch.lua
|
||||||
--Matthew Ellison
|
--Matthew Ellison
|
||||||
-- Created: 2-1-19
|
-- Created: 02-01-19
|
||||||
--Modified: 2-1-19
|
--Modified: 02-06-19
|
||||||
--This is a simple class to be used to time runtimes of various things within programs
|
--This is a simple class to be used to time runtimes of various things within programs
|
||||||
|
|
||||||
Stopwatch = {
|
Stopwatch = {
|
||||||
@@ -34,8 +34,12 @@ function Stopwatch:getTime()
|
|||||||
return (self.stopTime - self.startTime)
|
return (self.stopTime - self.startTime)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Stopwatch:getMicroseconds()
|
||||||
|
return math.floor(self:getTime() * 1000000)
|
||||||
|
end
|
||||||
|
|
||||||
function Stopwatch:getMilliseconds()
|
function Stopwatch:getMilliseconds()
|
||||||
return math.floor((self:getTime() * 1000))
|
return (self:getTime() * 1000)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Stopwatch:getSeconds()
|
function Stopwatch:getSeconds()
|
||||||
|
|||||||
Reference in New Issue
Block a user