Zeth - Zerocash on Ethereum
0.8
Reference implementation of the Zeth protocol by Clearmatics
client
zeth
core
timer.py
Go to the documentation of this file.
1
# Copyright (c) 2015-2022 Clearmatics Technologies Ltd
2
#
3
# SPDX-License-Identifier: LGPL-3.0+
4
5
from
__future__
import
annotations
6
import
time
7
from
typing
import
Optional
8
9
10
class
Timer
:
11
"""
12
Very simple class to help measure time.
13
"""
14
15
def
__init__
(self) -> None:
16
self.
_start_time
: Optional[float] =
None
17
18
def
start
(self) -> None:
19
assert
self.
_start_time
is
None
20
self.
_start_time
= time.time()
21
22
@staticmethod
23
def
started
() -> Timer:
24
timer =
Timer
()
25
timer.start()
26
return
timer
27
28
def
elapsed_seconds
(self) -> float:
29
assert
self.
_start_time
is
not
None
30
return
time.time() - self.
_start_time
zeth.core.timer.Timer
Definition:
timer.py:10
zeth.core.timer.Timer.start
None start(self)
Definition:
timer.py:18
zeth.core.timer.Timer._start_time
_start_time
Definition:
timer.py:20
zeth.core.timer.Timer.started
Timer started()
Definition:
timer.py:23
zeth.core.timer.Timer.__init__
None __init__(self)
Definition:
timer.py:15
zeth.core.timer.Timer.elapsed_seconds
float elapsed_seconds(self)
Definition:
timer.py:28
Generated on Mon Nov 28 2022 10:29:03 for Zeth - Zerocash on Ethereum by
1.8.17