From f9cce574cbca31cf8062d1e8ea3606fe0f1e07ab Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Wed, 6 Feb 2019 02:00:24 -0500 Subject: [PATCH] Updated stopwatch to show microsecond precision, works on linux --- Stopwatch.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Stopwatch.lua b/Stopwatch.lua index 78ee332..3c6345b 100644 --- a/Stopwatch.lua +++ b/Stopwatch.lua @@ -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()