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:
@@ -9,7 +9,9 @@ start markers.
|
||||
from __future__ import annotations
|
||||
|
||||
import struct
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime
|
||||
|
||||
from app.config import BEIJING_TZ
|
||||
from typing import Any, Dict, List, Tuple
|
||||
|
||||
from .constants import (
|
||||
@@ -226,7 +228,7 @@ class PacketParser:
|
||||
yy, mo, dd, hh, mi, ss = struct.unpack_from("BBBBBB", data, offset)
|
||||
year = 2000 + yy
|
||||
try:
|
||||
dt = datetime(year, mo, dd, hh, mi, ss, tzinfo=timezone.utc)
|
||||
dt = datetime(year, mo, dd, hh, mi, ss, tzinfo=BEIJING_TZ)
|
||||
except ValueError:
|
||||
dt = None
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user