Skip to content

Commit 4714531

Browse files
feat: format execution time in html reports as hh:mm:ss
1 parent 77ef748 commit 4714531

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/askui/reporting.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -788,10 +788,10 @@ def generate(self) -> None:
788788
<div class="section">
789789
<h2>Execution Statistics</h2>
790790
<table class="system-info">
791-
{% if execution_time_seconds is not none %}
791+
{% if execution_time_formatted is not none %}
792792
<tr>
793793
<th>Execution Time</th>
794-
<td>{{ "%.2f"|format(execution_time_seconds) }} seconds</td>
794+
<td>{{ execution_time_formatted }}</td>
795795
</tr>
796796
{% endif %}
797797
{% if usage_summary is not none %}
@@ -903,17 +903,20 @@ def generate(self) -> None:
903903

904904
# Calculate execution time
905905
end_time = datetime.now(tz=timezone.utc)
906-
execution_time_seconds: float | None = None
906+
execution_time_formatted: str | None = None
907907
if self._start_time is not None:
908-
execution_time_seconds = (end_time - self._start_time).total_seconds()
908+
total_secs = int((end_time - self._start_time).total_seconds())
909+
hours, remainder = divmod(total_secs, 3600)
910+
minutes, secs = divmod(remainder, 60)
911+
execution_time_formatted = f"{hours:02d}:{minutes:02d}:{secs:02d}"
909912

910913
html = template.render(
911914
timestamp=end_time,
912915
messages=self.messages,
913916
system_info=self.system_info,
914917
usage_summary=self.usage_summary,
915918
cache_original_usage=self.cache_original_usage,
916-
execution_time_seconds=execution_time_seconds,
919+
execution_time_formatted=execution_time_formatted,
917920
)
918921

919922
report_path = (

0 commit comments

Comments
 (0)