mirror of
https://bitbucket.org/Mattrixwv/luaclasses.git
synced 2025-12-06 18:33:59 -05:00
Fixed bug that was giving an error in time
This commit is contained in:
@@ -49,11 +49,11 @@ end
|
||||
function Stopwatch:getTime()
|
||||
local timeDifference = nil;
|
||||
--If start and stop has been called return the difference
|
||||
if(startTime and stopTime) then
|
||||
timeDifference = endTime - startTime;
|
||||
if((self.startTime ~= nil) and (self.stopTime ~= nil)) then
|
||||
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(startTime and not stopTime) then
|
||||
timeDifference = os.time() - startTime;
|
||||
elseif((self.startTime ~= nil) and (self.stopTime == nil)) then
|
||||
timeDifference = os.time() - self.startTime;
|
||||
--Otherwise return -1 as an error
|
||||
else
|
||||
timeDifference = -1;
|
||||
|
||||
Reference in New Issue
Block a user