Skip to content

Commit 4f99424

Browse files
committed
Fix Python 3.7 DeprecationWarning: time.clock will be removed in Python 3.8
1 parent 562c127 commit 4f99424

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

PyDSTool/common.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,12 @@ def timestamp(tdigits=8):
14961496
"""Return a unique timestamp string for the session. useful for ensuring
14971497
unique function identifiers, etc.
14981498
"""
1499-
return str(time.clock()).replace(".", "").replace("-","")[:tdigits+1]
1499+
try:
1500+
t = time.process_time()
1501+
except AttributeError:
1502+
# Python 2.7 compatibility
1503+
t = time.clock()
1504+
return str(t).replace(".", "").replace("-", "")[:tdigits + 1]
15001505

15011506

15021507
def isUniqueSeq(objlist):

0 commit comments

Comments
 (0)