修正时区差异

This commit is contained in:
zhangkun9038@dingtalk.com 2026-02-13 11:52:57 +08:00
parent 8c0ec70aa9
commit dc200442cf

View File

@ -977,9 +977,12 @@ class FreqaiPrimer(IStrategy):
display_latest = display_latest.replace(tzinfo=timezone.utc)
display_latest = display_latest.astimezone(UTC_PLUS_8)
latest_time_str = display_latest.strftime('%H:%M:%S')
# 计算数据新鲜度
# 计算数据新鲜度(修正时区差异)
latest_naive = display_latest.replace(tzinfo=None)
data_freshness = (datetime.now() - latest_naive).total_seconds() / 60
current_time_utc8 = datetime.now().replace(tzinfo=UTC_PLUS_8).replace(tzinfo=None)
data_freshness = (current_time_utc8 - latest_naive).total_seconds() / 60
# 修正时区差异后的判断
if data_freshness <= 10:
fresh_icon = ""
elif data_freshness <= 30:
@ -999,7 +1002,10 @@ class FreqaiPrimer(IStrategy):
display_latest = display_latest.astimezone(UTC_PLUS_8)
latest_time_str = display_latest.strftime('%H:%M:%S')
latest_naive = display_latest.replace(tzinfo=None)
data_freshness = (datetime.now() - latest_naive).total_seconds() / 60
current_time_utc8 = datetime.now().replace(tzinfo=UTC_PLUS_8).replace(tzinfo=None)
data_freshness = (current_time_utc8 - latest_naive).total_seconds() / 60
# 修正时区差异后的判断
if data_freshness <= 10:
fresh_icon = ""
elif data_freshness <= 30: