forked from cuberite/WorldEdit
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test function from cBlockArea and class cStopWatch
- Loading branch information
1 parent
77f40c9
commit ce54af7
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
cStopWatch = {} | ||
cStopWatch.__index = cStopWatch | ||
|
||
function cStopWatch.new() | ||
local self = setmetatable({}, cStopWatch) | ||
return self | ||
end | ||
|
||
|
||
function cStopWatch:Start() | ||
self.m_IsRunning = true | ||
self.m_Start = cRoot:Get():GetCurrentTimeInMillseconds() | ||
end | ||
|
||
|
||
|
||
function cStopWatch:Stop() | ||
self.m_IsRunning = false | ||
self.m_Stop = cRoot:Get():GetCurrentTimeInMillseconds() | ||
end | ||
|
||
|
||
|
||
function cStopWatch:GetElapsedMilliseconds() | ||
if self.m_Start == nil then | ||
return 0 | ||
end | ||
if self.m_IsRunning then | ||
return cRoot:Get():GetCurrentTimeInMillseconds() - self.m_Start | ||
else | ||
return self.m_Stop - self.m_Start | ||
end | ||
end |