Sync time periodically

This commit is contained in:
Jack Kingsman
2026-01-14 16:22:50 -08:00
parent 92e7cd24e6
commit 91c9258275
4 changed files with 70 additions and 4 deletions
+2 -4
View File
@@ -1,11 +1,11 @@
import logging
import time
from fastapi import APIRouter, HTTPException
from meshcore import EventType
from pydantic import BaseModel, Field
from app.dependencies import require_connected
from app.radio_sync import sync_radio_time
logger = logging.getLogger(__name__)
router = APIRouter(prefix="/radio", tags=["radio"])
@@ -101,9 +101,7 @@ async def update_radio_config(update: RadioConfigUpdate) -> RadioConfigResponse:
)
# Sync time with system clock
now = int(time.time())
logger.debug("Syncing radio time to %d", now)
await mc.commands.set_time(now)
await sync_radio_time()
return await get_radio_config()