Unify all timestamps to Beijing time (UTC+8)
- Add BEIJING_TZ constant in config.py - Replace all timezone.utc references across 11 files - Device-reported times, DB defaults, protocol sync all use Beijing time via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run>
This commit is contained in:
@@ -8,7 +8,9 @@ from __future__ import annotations
|
||||
|
||||
import struct
|
||||
import time
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime
|
||||
|
||||
from app.config import BEIJING_TZ
|
||||
from typing import Optional
|
||||
|
||||
from .constants import (
|
||||
@@ -141,9 +143,9 @@ class PacketBuilder:
|
||||
"""
|
||||
Build a Time Sync 2 response (0x8A).
|
||||
|
||||
Returns the current UTC time as YY MM DD HH MM SS (6 bytes).
|
||||
Returns the current Beijing time as YY MM DD HH MM SS (6 bytes).
|
||||
"""
|
||||
now = datetime.now(timezone.utc)
|
||||
now = datetime.now(BEIJING_TZ)
|
||||
info = struct.pack(
|
||||
"BBBBBB",
|
||||
now.year - 2000,
|
||||
|
||||
Reference in New Issue
Block a user