time.clock() now emits a DeprecationWarning (GH-4020)
bpo-31803: time.clock() and time.get_clock_info('clock') now emit a
DeprecationWarning warning.
Replace time.clock() with time.perf_counter() in tests and demos.
Remove also hasattr(time, 'monotonic') in test_time since time.monotonic()
is now always available since Python 3.5.
diff --git a/Lib/turtledemo/bytedesign.py b/Lib/turtledemo/bytedesign.py
index b3b095b..1b7452b 100755
--- a/Lib/turtledemo/bytedesign.py
+++ b/Lib/turtledemo/bytedesign.py
@@ -23,7 +23,7 @@
"""
from turtle import Turtle, mainloop
-from time import clock
+from time import perf_counter as clock
# wrapper for any additional drawing routines
# that need to know about each other
diff --git a/Lib/turtledemo/forest.py b/Lib/turtledemo/forest.py
index 7fe080e..55b7da9 100755
--- a/Lib/turtledemo/forest.py
+++ b/Lib/turtledemo/forest.py
@@ -13,7 +13,7 @@
"""
from turtle import Turtle, colormode, tracer, mainloop
from random import randrange
-from time import clock
+from time import perf_counter as clock
def symRandom(n):
return randrange(-n,n+1)
diff --git a/Lib/turtledemo/fractalcurves.py b/Lib/turtledemo/fractalcurves.py
index c49f8b8..54ade96 100755
--- a/Lib/turtledemo/fractalcurves.py
+++ b/Lib/turtledemo/fractalcurves.py
@@ -12,7 +12,7 @@
scripts for turtle-graphics.
"""
from turtle import *
-from time import sleep, clock
+from time import sleep, perf_counter as clock
class CurvesTurtle(Pen):
# example derived from
diff --git a/Lib/turtledemo/penrose.py b/Lib/turtledemo/penrose.py
index f73c864..b2a5813 100755
--- a/Lib/turtledemo/penrose.py
+++ b/Lib/turtledemo/penrose.py
@@ -17,7 +17,7 @@
"""
from turtle import *
from math import cos, pi
-from time import clock, sleep
+from time import perf_counter as clock, sleep
f = (5**0.5-1)/2.0 # (sqrt(5)-1)/2 -- golden ratio
d = 2 * cos(3*pi/10)
diff --git a/Lib/turtledemo/tree.py b/Lib/turtledemo/tree.py
index 71fff35..9998fa8 100755
--- a/Lib/turtledemo/tree.py
+++ b/Lib/turtledemo/tree.py
@@ -16,7 +16,7 @@
there are 1024 turtles.
"""
from turtle import Turtle, mainloop
-from time import clock
+from time import perf_counter as clock
def tree(plist, l, a, f):
""" plist is list of pens
diff --git a/Lib/turtledemo/wikipedia.py b/Lib/turtledemo/wikipedia.py
index d6bbad8..47d0f00 100644
--- a/Lib/turtledemo/wikipedia.py
+++ b/Lib/turtledemo/wikipedia.py
@@ -14,7 +14,7 @@
Followed by a complete undo().
"""
from turtle import Screen, Turtle, mainloop
-from time import clock, sleep
+from time import perf_counter as clock, sleep
def mn_eck(p, ne,sz):
turtlelist = [p]