ClickHouse/tests/ci/stopwatch.py

17 lines
430 B
Python
Raw Normal View History

2021-11-19 14:47:04 +00:00
#!/usr/bin/env python3
import datetime
class Stopwatch():
def __init__(self):
self.start_time = datetime.datetime.utcnow()
2021-11-19 15:24:39 +00:00
self.start_time_str_value = self.start_time.strftime("%Y-%m-%d %H:%M:%S")
2021-11-19 14:47:04 +00:00
@property
def duration_seconds(self):
return (datetime.datetime.utcnow() - self.start_time).total_seconds()
@property
def start_time_str(self):
2021-11-19 15:24:39 +00:00
return self.start_time_str_value