From b8b60bf3141b19a31198d1d874992ca46c78a486 Mon Sep 17 00:00:00 2001 From: htlee Date: Thu, 2 Apr 2026 07:05:15 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20timestamp=20fallback=EC=97=90=EC=84=9C?= =?UTF-8?q?=20UTC=E2=86=92KST=20=EB=B3=80=ED=99=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- prediction/cache/vessel_store.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/prediction/cache/vessel_store.py b/prediction/cache/vessel_store.py index e73fea4..3cab5e5 100644 --- a/prediction/cache/vessel_store.py +++ b/prediction/cache/vessel_store.py @@ -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)