fix(reporter): emit UTC-aware timestamps for state and heal history

This commit is contained in:
patrick committed 2026-03-06 19:22:25 -05:00
1 parent ecda631049
commit 1013b05790
1 file changed
+4 -4
+4 -4
View File
@@ -4,7 +4,7 @@ import json
import os import os
import logging import logging
import time import time
from datetime import datetime from datetime import datetime, timezone
class LocalStateReporter: class LocalStateReporter:
""" """
@@ -140,7 +140,7 @@ class LocalStateReporter:
effective_last_heal_timestamp = ( effective_last_heal_timestamp = (
last_heal_timestamp last_heal_timestamp
if last_heal_timestamp is not None if last_heal_timestamp is not None
else datetime.now().isoformat() else datetime.now(timezone.utc).isoformat()
) )
now_epoch = time.time() now_epoch = time.time()
@@ -176,7 +176,7 @@ class LocalStateReporter:
uptime_seconds = max(0, int(now_epoch - self.started_at_epoch)) uptime_seconds = max(0, int(now_epoch - self.started_at_epoch))
status_data = { status_data = {
"node_name": self.node_name, "node_name": self.node_name,
"last_check": datetime.now().isoformat(), "last_check": datetime.now(timezone.utc).isoformat(),
"status": "HEALTHY" if is_synced else "DESYNC_DETECTED", "status": "HEALTHY" if is_synced else "DESYNC_DETECTED",
"is_synced": is_synced, "is_synced": is_synced,
"kernel_ban_count": ban_count, "kernel_ban_count": ban_count,
@@ -228,7 +228,7 @@ class LocalStateReporter:
Records a specific healing event in a persistent history log. Records a specific healing event in a persistent history log.
""" """
history_file = self.get_history_file() history_file = self.get_history_file()
timestamp = datetime.now().isoformat() timestamp = datetime.now(timezone.utc).isoformat()
try: try:
with open(history_file, 'a') as f: with open(history_file, 'a') as f: