diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2017-02-04 13:50:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-04 13:50:34 +0100 |
commit | 42f669beab39df38d2f4955b651541272126a04e (patch) | |
tree | f68d918629725f9306698bf0641910d1f714714b /lualibs-trac-inf.lua | |
parent | 144f6d16fd79bd0496b3ae379b69227e0d9bbfa9 (diff) | |
parent | 1b2f8c0355210dbfd34b10ed4ff7f0c90fda062d (diff) | |
download | lualibs-master.tar.gz |
v2.5
Diffstat (limited to 'lualibs-trac-inf.lua')
-rw-r--r-- | lualibs-trac-inf.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lualibs-trac-inf.lua b/lualibs-trac-inf.lua index a1d7fb0..12a4f64 100644 --- a/lualibs-trac-inf.lua +++ b/lualibs-trac-inf.lua @@ -61,12 +61,13 @@ local function stoptiming(instance) timer.timing = it - 1 else local starttime = timer.starttime - if starttime then - local stoptime = clock() - local loadtime = stoptime - starttime - timer.stoptime = stoptime - timer.loadtime = timer.loadtime + loadtime - timer.timing = 0 + if starttime and starttime > 0 then + local stoptime = clock() + local loadtime = stoptime - starttime + timer.stoptime = stoptime + timer.loadtime = timer.loadtime + loadtime + timer.timing = 0 + timer.starttime = 0 return loadtime end end @@ -183,7 +184,7 @@ end function statistics.runtime() stoptiming(statistics) - stoptiming(statistics) -- somehow we can start the timer twice, but where + -- stoptiming(statistics) -- somehow we can start the timer twice, but where return statistics.formatruntime(elapsedtime(statistics)) end |