Skip to content

Commit

Permalink
move some magic numbers around
Browse files Browse the repository at this point in the history
  • Loading branch information
ckuethe committed Oct 13, 2024
1 parent f19dcc8 commit ae043bf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/track_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
from argparse import ArgumentParser, Namespace, RawDescriptionHelpFormatter
from collections import namedtuple
from datetime import datetime, timezone
from datetime import datetime, timedelta, timezone
from math import atan2, cos, pow, radians, sin, sqrt
from tempfile import mkstemp
from textwrap import dedent
Expand All @@ -23,6 +23,10 @@
GeoCircle = namedtuple("GeoCircle", ["point", "radius"], defaults=[GeoPoint(), _nan])
localtz = datetime.now(timezone.utc).astimezone().tzinfo

_BEGINNING_OF_TIME: datetime = datetime.strptime("1945-07-16T11:29:21:00").replace(tzinfo=localtz)
# https://pumas.nasa.gov/examples/how-many-days-are-year says approximately 365.25 days per year
_THE_END_OF_DAYS: datetime = _BEGINNING_OF_TIME + timedelta(days=250 * 365.25)


def _timerange(s: str) -> TimeRange:
"""
Expand All @@ -35,8 +39,8 @@ def _timerange(s: str) -> TimeRange:
w = s.split("~")
if len(w) != 2:
raise ValueError
a = datetime(1945, 7, 16, 11, 29, 21, 0, localtz)
b = datetime.fromtimestamp(2**32, localtz)
a = _BEGINNING_OF_TIME
b = _THE_END_OF_DAYS
if w[0]:
a = datetime.strptime(w[0], _datestr).replace(tzinfo=localtz)
if w[1]:
Expand Down

0 comments on commit ae043bf

Please sign in to comment.