diff options
author | Erik Troan <ewt@redhat.com> | 2000-12-08 18:43:23 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 2000-12-08 18:43:23 +0000 |
commit | 791f649648560413e4a3f31cf6c50ee50e3a2c75 (patch) | |
tree | 9cc347e00a94fdea28b1b8619eedb70e3fcb1840 /timer.py | |
parent | d3f64b8761ddc9cd9686c9a6f42947d4545a9396 (diff) | |
download | anaconda-791f649648560413e4a3f31cf6c50ee50e3a2c75.tar.gz anaconda-791f649648560413e4a3f31cf6c50ee50e3a2c75.tar.xz anaconda-791f649648560413e4a3f31cf6c50ee50e3a2c75.zip |
use separate timer for install which can be stopped and started
Diffstat (limited to 'timer.py')
-rw-r--r-- | timer.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/timer.py b/timer.py new file mode 100644 index 000000000..502a359a6 --- /dev/null +++ b/timer.py @@ -0,0 +1,23 @@ +import time + +class Timer: + + def stop(self): + if self.startedAt > -1: + self.total = self.total + (time.time() - self.startedAt) + self.startedAt = -1 + + def start(self): + if self.startedAt == -1: + self.startedAt = time.time() + + def elapsed(self): + if self.startedAt == -1: + return self.total + else: + return self.total + (time.time() - self.startedAt) + + def __init__(self, start = 1): + self.total = 0 + self.startedAt = -1 + self.start() |