ClickHouse/tests/ci/stopwatch.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
429 B
Python
Raw Normal View History

2021-11-19 14:47:04 +00:00
#!/usr/bin/env python3
import datetime
class Stopwatch:
2021-11-19 14:47:04 +00:00
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