mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
added formatTimeCompact
This commit is contained in:
parent
838fe42ba7
commit
ad5749c61e
@ -29,7 +29,7 @@ __all__ = ['enumerate', 'unique', 'indent', 'nonRepeatingRandomList',
|
|||||||
'GoldenRectangle', 'pivotScalar', 'rad90', 'rad180', 'rad270', 'rad360',
|
'GoldenRectangle', 'pivotScalar', 'rad90', 'rad180', 'rad270', 'rad360',
|
||||||
'nullGen', 'loopGen', 'makeFlywheelGen', 'flywheel', 'choice',
|
'nullGen', 'loopGen', 'makeFlywheelGen', 'flywheel', 'choice',
|
||||||
'printStack', 'printReverseStack', 'listToIndex2item', 'listToItem2index',
|
'printStack', 'printReverseStack', 'listToIndex2item', 'listToItem2index',
|
||||||
'pandaBreak','pandaTrace']
|
'pandaBreak','pandaTrace','formatTimeCompact']
|
||||||
|
|
||||||
import types
|
import types
|
||||||
import string
|
import string
|
||||||
@ -3315,6 +3315,26 @@ def recordFunctorCreationStacks():
|
|||||||
Functor._functorCreationStacksRecorded = True
|
Functor._functorCreationStacksRecorded = True
|
||||||
Functor.__call__ = Functor._exceptionLoggedCreationStack__call__
|
Functor.__call__ = Functor._exceptionLoggedCreationStack__call__
|
||||||
|
|
||||||
|
def formatTimeCompact(seconds):
|
||||||
|
# returns string in format '1d3h22m43s'
|
||||||
|
result = ''
|
||||||
|
a = int(seconds)
|
||||||
|
seconds = a % 60
|
||||||
|
a /= 60
|
||||||
|
if a > 0:
|
||||||
|
minutes = a % 60
|
||||||
|
a /= 60
|
||||||
|
if a > 0:
|
||||||
|
hours = a % 24
|
||||||
|
a /= 24
|
||||||
|
if a > 0:
|
||||||
|
days = a
|
||||||
|
result += '%sd' % days
|
||||||
|
result += '%sh' % hours
|
||||||
|
result += '%sm' % minutes
|
||||||
|
result += '%ss' % seconds
|
||||||
|
return result
|
||||||
|
|
||||||
globalPdb = None
|
globalPdb = None
|
||||||
|
|
||||||
traceCalled = False
|
traceCalled = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user