Fixed bug when calling getString without

first calling stop
This commit is contained in:
2019-10-13 19:01:06 -04:00
parent 202129f4cc
commit e25b12e9dc

View File

@@ -77,7 +77,7 @@ function Stopwatch:getTime()
timeDifference = self.stopTime - self.startTime;
--If start has been called but stop hasn't make the current time the end time. This simulates looking at a stopwatch while it is still running
elseif((self.startTime ~= nil) and (self.stopTime == nil)) then
timeDifference = os.time() - self.startTime;
timeDifference = os.clock() - self.startTime;
--Otherwise return -1 as an error
else
timeDifference = -1;
@@ -183,7 +183,7 @@ function Stopwatch:getString()
elseif(timeResoltuion == Stopwatch.timeResolution.hours) then
timeString = string.format("%.3f hours", timeDifference);
else
timeString = "ERROR!";
timeString = "ERROR! TimeResolution = " .. timeResolution;
end
--Return the string