reports: use timezone-aware UTC for timestamps\n\n- Replace deprecated datetime.utcnow() with datetime.now(timezone.utc)\n- Keeps existing human-friendly format while avoiding deprecation warnings\n- Applies to marker file and generated_at in stats
This commit is contained in:
parent
2bfd487106
commit
8eec623c92
1 changed files with 5 additions and 3 deletions
|
@ -3,7 +3,7 @@ import sqlite3
|
|||
from pathlib import Path
|
||||
import shutil
|
||||
from typing import List, Dict, Optional
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
import time
|
||||
|
||||
import yaml
|
||||
|
@ -37,7 +37,8 @@ def _cli_callback(ctx: typer.Context) -> None:
|
|||
|
||||
def _write_marker() -> None:
|
||||
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
timestamp = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")
|
||||
# Use timezone-aware UTC to avoid deprecation warnings and ambiguity
|
||||
timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
|
||||
GENERATED_MARKER.write_text(f"{timestamp}\n")
|
||||
|
||||
ctx.call_on_close(_write_marker)
|
||||
|
@ -271,7 +272,8 @@ def _generate_global() -> None:
|
|||
return
|
||||
|
||||
start_time = time.time()
|
||||
generated_at = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")
|
||||
# Use timezone-aware UTC for generated_at (string remains unchanged format)
|
||||
generated_at = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
_copy_icons()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue