fix: timestamp fallback에서 UTC→KST 변환 추가
Codex 리뷰 지적: timestamp fallback 분기에서 UTC aware 값을 replace(tzinfo=None)로 tz만 제거하면 KST time_bucket과 9시간 어긋남. astimezone(KST) 후 tz 제거하도록 수정. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
부모
d15039ce18
커밋
b8b60bf314
6
prediction/cache/vessel_store.py
vendored
6
prediction/cache/vessel_store.py
vendored
@ -1,8 +1,11 @@
|
||||
import logging
|
||||
from datetime import datetime, timezone
|
||||
from typing import Optional
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
import numpy as np
|
||||
|
||||
_KST = ZoneInfo('Asia/Seoul')
|
||||
import pandas as pd
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -126,8 +129,9 @@ class VesselStore:
|
||||
max_ts = pd.to_datetime(df_all['timestamp'].dropna()).max()
|
||||
if hasattr(max_ts, 'to_pydatetime'):
|
||||
max_ts = max_ts.to_pydatetime()
|
||||
# timestamp는 UTC aware → KST wall-clock naive로 변환
|
||||
if isinstance(max_ts, datetime) and max_ts.tzinfo is not None:
|
||||
max_ts = max_ts.replace(tzinfo=None)
|
||||
max_ts = max_ts.astimezone(_KST).replace(tzinfo=None)
|
||||
self._last_bucket = max_ts
|
||||
|
||||
vessel_count = len(self._tracks)
|
||||
|
||||
불러오는 중...
Reference in New Issue
Block a user