Sky and ISS views
Two new views, picked from mockups. `sky`: a star chart of the sky over Zlín as seen lying on your back, with the planets, the moon in its phase, tonight's darkness, cloud for the next 12 hours and the next visible ISS pass. `iss`: a dotted world map with day and night, the ISS and its ground track, and the next pass over Zlín with the cloud cover for that hour. Positions are calculated locally with ephem; only the ISS orbit (CelesTrak, every 6 h, retried gently) and cloud cover (Open-Meteo) are fetched. The poller gained a per-source retry delay for that. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
6c9a1420d2
commit
2132262896
28 files changed
+1342
-18
No files matched your search
+16
-3
@@ -1,12 +1,25 @@
|
||||
"""Wall-clock time independent of the container's own TZ."""
|
||||
import os
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
DEFAULT_TZ = "Europe/Prague"
|
||||
|
||||
|
||||
def _zone(tz_name: str | None) -> ZoneInfo:
|
||||
return ZoneInfo(tz_name or os.environ.get("BOARD_TZ", DEFAULT_TZ))
|
||||
|
||||
|
||||
def local_now(tz_name: str | None = None) -> datetime:
|
||||
"""Naive wall-clock time in `tz_name` (default: env BOARD_TZ, else Europe/Prague)."""
|
||||
name = tz_name or os.environ.get("BOARD_TZ", DEFAULT_TZ)
|
||||
return datetime.now(ZoneInfo(name)).replace(tzinfo=None)
|
||||
return datetime.now(_zone(tz_name)).replace(tzinfo=None)
|
||||
|
||||
|
||||
def to_utc(local: datetime, tz_name: str | None = None) -> datetime:
|
||||
"""Naive wall-clock time in `tz_name` as naive UTC."""
|
||||
return local.replace(tzinfo=_zone(tz_name)).astimezone(timezone.utc).replace(tzinfo=None)
|
||||
|
||||
|
||||
def from_utc(utc: datetime, tz_name: str | None = None) -> datetime:
|
||||
"""Naive UTC as naive wall-clock time in `tz_name`."""
|
||||
return utc.replace(tzinfo=timezone.utc).astimezone(_zone(tz_name)).replace(tzinfo=None)
|
||||
Reference in new issue
Block a user