diff --git a/etcd3gw/examples/etcd.py b/etcd3gw/examples/etcd.py index 9b019b0..b4245b1 100644 --- a/etcd3gw/examples/etcd.py +++ b/etcd3gw/examples/etcd.py @@ -10,12 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -try: - # Python 3.8 : time.clock was deprecated and removed. - from time import perf_counter as clock -except ImportError: - from time import clock - +import time from etcd3gw.client import Etcd3Client from etcd3gw.lock import Lock @@ -59,7 +54,7 @@ def main(): print("Key delete foo-unknown : %r" % result) print('>>>> Lock') - lock = Lock('xyz-%s' % clock(), ttl=10000, client=client) + lock = Lock('xyz-%s' % time.perf_counter(), ttl=10000, client=client) result = lock.acquire() print("acquire : %r" % result) result = lock.refresh() diff --git a/etcd3gw/tests/test_etcd3gw.py b/etcd3gw/tests/test_etcd3gw.py index 1195cfa..158d866 100644 --- a/etcd3gw/tests/test_etcd3gw.py +++ b/etcd3gw/tests/test_etcd3gw.py @@ -33,12 +33,6 @@ from etcd3gw import exceptions from etcd3gw.tests import base from etcd3gw import utils -try: - # Python 3.8 : time.clock was deprecated and removed. - from time import perf_counter as clock -except ImportError: - from time import clock - def _is_etcd3_running(): try: @@ -413,7 +407,7 @@ class TestEtcd3Gateway(base.TestCase): @unittest.skipUnless( _is_etcd3_running(), "etcd3 is not available") def test_client_locks(self): - lock = self.client.lock(id='xyz-%s' % clock(), ttl=60) + lock = self.client.lock(id='xyz-%s' % time.perf_counter(), ttl=60) self.assertIsNotNone(lock) self.assertTrue(lock.acquire())