fix: 매시 정각~14분에 지금 날씨가 예보로 돌아가던 것 — 새 실황은 15분부터 쓰고, 그 전엔 시각은 그대로 두고 앞 시각 관측을 이어서
This commit is contained in:
1 parent
3baa543313
commit
fb483c6b50
11 files changed
+62
-40
No files matched your search
@@ -5,7 +5,7 @@ KST = timezone(timedelta(hours=9))
|
||||
VILAGE_BASE_HOURS = (2, 5, 8, 11, 14, 17, 20, 23)
|
||||
VILAGE_DELAY = timedelta(minutes=10)
|
||||
ULTRA_DELAY = timedelta(minutes=15)
|
||||
NCST_DELAY = timedelta(minutes=10)
|
||||
NCST_DELAY = timedelta(minutes=15) # 실황은 정시 10분 뒤부터 나오지만, 늦게 올라오는 때를 피해 15분부터 쓴다
|
||||
|
||||
|
||||
def now_kst() -> datetime:
|
||||
@@ -34,7 +34,7 @@ def next_vilage_available(now: datetime) -> datetime:
|
||||
|
||||
|
||||
def latest_ncst_base(now: datetime) -> datetime:
|
||||
"""지금 받을 수 있는 가장 최근 초단기실황 발표 시각 (정시 발표, 10분 뒤부터 제공)."""
|
||||
"""지금 쓰는 초단기실황 발표 시각 (정시 발표, 15분부터 쓴다). 매시 00~14분엔 앞 시각 것."""
|
||||
now = now.astimezone(KST)
|
||||
base = now.replace(minute=0, second=0, microsecond=0)
|
||||
return base if base + NCST_DELAY <= now else base - timedelta(hours=1)
|
||||
|
||||
Reference in new issue
Block a user