diff options
author | Nico Schlömer <nico.schloemer@gmail.com> | 2022-09-03 11:21:30 +0200 |
---|---|---|
committer | Nico Schlömer <nico.schloemer@gmail.com> | 2022-09-03 11:21:30 +0200 |
commit | 238dcfdcdcb7e91edb989243f175bb799d458f95 (patch) | |
tree | df83a1b865e37036d5c6adf71e81a682e94066ae | |
parent | 01fcefab71e1a7ea36f8b1926c073d3c3271ca02 (diff) |
pre-commit update
-rw-r--r-- | .pre-commit-config.yaml | 6 | ||||
-rw-r--r-- | src/tiptop/_info.py | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a1e83ea..a2dfc46 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,17 +5,17 @@ repos: - id: isort - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 22.8.0 hooks: - id: black language_version: python3 - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 5.0.4 hooks: - id: flake8 - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.6.2 + rev: v3.0.0-alpha.0 hooks: - id: prettier diff --git a/src/tiptop/_info.py b/src/tiptop/_info.py index 29514d5..36cd37d 100644 --- a/src/tiptop/_info.py +++ b/src/tiptop/_info.py @@ -43,8 +43,8 @@ class InfoLine(Widget): def render(self): uptime_s = time.time() - self.boot_time - d = datetime(1, 1, 1) + timedelta(seconds=uptime_s) - right = [f"up {d.day - 1}d, {d.hour}:{d.minute:02d}h"] + d, h, m = days_hours_minutes(timedelta(seconds=uptime_s)) + right = [f"up {d}d, {h}:{m:02d}h"] table = Table(show_header=False, expand=True, box=None, padding=0) if self.width < 100: @@ -63,3 +63,7 @@ class InfoLine(Widget): async def on_resize(self, event): self.width = event.width self.height = event.height + + +def days_hours_minutes(td): + return td.days, td.seconds // 3600, (td.seconds // 60) % 60 |