"""Gemeinsame Formatierungshelfer für die GUI (Dauer- und Zeitstempelanzeige).""" from __future__ import annotations from datetime import datetime def format_duration(seconds: float) -> str: total_seconds = max(0, int(seconds)) hours, remainder = divmod(total_seconds, 3600) minutes, secs = divmod(remainder, 60) if hours: return f"{hours:02d}:{minutes:02d}:{secs:02d}" return f"{minutes:02d}:{secs:02d}" def format_timestamp(iso_timestamp: str) -> str: try: return datetime.fromisoformat(iso_timestamp).strftime("%d.%m.%Y %H:%M:%S") except ValueError: return iso_timestamp