diff --git a/src/dnidatetime/constants.py b/src/dnidatetime/constants.py index 8814949..8bcc95a 100644 --- a/src/dnidatetime/constants.py +++ b/src/dnidatetime/constants.py @@ -5,6 +5,7 @@ from datetime import datetime, timezone from typing import Tuple, TypedDict +#: Type alias for a seven-integer tuple used in a datetime timestamp. DniDateTimeTuple = Tuple[int, int, int, int, int, int, int] @@ -16,22 +17,22 @@ class DniUnitType(TypedDict): total_pro: int -# All the units of time in the D'Ni culture from largest to smallest. -# -# Hahr - The D'Ni eqivalent of an earth year. -# Vailee - The D'Ni eqivalent of an earth month, 10 total in each hahr. -# Yahr - The D'Ni equivalent of an earth day, 29 total in each vailee. -# Gahrtahvo - 5 total in each yahr. -# Pahrtahvo - The D'Ni equivalent of an earth hour, 5 total in each gahrtahvo -# and 25 total in each yahr. Not used in calculations, but can -# be used to show a different method of D'Ni time. -# Tahvo - 5 total in each pahrtahvo and 25 total in each gahrtahvo. -# Gorahn - 25 total in each tahvo. -# Prorahn - The D'Ni equivalent of an earth second, 25 total in each gorahn. -# -# Limit: Maximum amount before rollover (ie. 60 seconds in 1 minute) -# Total Prorahntee: A "prorahn" is the smallest unit of time and is -# used in the calcuation of the other units. +#: All the units of time in the D'Ni culture from largest to smallest. +#: +#: Hahr - The D'Ni eqivalent of an earth year. +#: Vailee - The D'Ni eqivalent of an earth month, 10 total in each hahr. +#: Yahr - The D'Ni equivalent of an earth day, 29 total in each vailee. +#: Gahrtahvo - 5 total in each yahr. +#: Pahrtahvo - The D'Ni equivalent of an earth hour, 5 total in each gahrtahvo +#: and 25 total in each yahr. Not used in calculations, but can +#: be used to show a different method of D'Ni time. +#: Tahvo - 5 total in each pahrtahvo and 25 total in each gahrtahvo. +#: Gorahn - 25 total in each tahvo. +#: Prorahn - The D'Ni equivalent of an earth second, 25 total in each gorahn. +#: +#: Limit: Maximum amount before rollover (ie. 60 seconds in 1 minute) +#: Total Prorahntee: A "prorahn" is the smallest unit of time and is +#: used in the calcuation of the other units. DNI_UNITS: OrderedDict[str, DniUnitType] = OrderedDict( [ ("hahr", {"min": 7654, "max": 17655, "total_pro": 22656250}), @@ -44,27 +45,24 @@ DNI_UNITS: OrderedDict[str, DniUnitType] = OrderedDict( ] ) -# A hahr's length is equal to the Mean Solar Tropical Year for 1995 in -# milliseconds. +#: A hahr's length is equal to the Mean Solar Tropical Year for 1995 in +#: milliseconds. MS_PER_HAHR = 31556925216 -# A prorahn's length in milliseconds. -# Some previous [wrong] calculations: -# JS = 1392.8573857142859 -# Python = 1392.8573888441379 +#: A prorahn's length in milliseconds. MS_PER_PRORAHN = 1392.85737275 -# Just as the UNIX Epoch is based on midnight on 1-1-1970, the D'Ni Epoch -# is based on the timestamp of the original MYST Hypercard file: -# April 21, 1991 9:54AM PST (16:54 UTC) --> Leefo 1, 9647 00:00:00:00 +#: Just as the UNIX Epoch is based on midnight on 1-1-1970, the D'Ni Epoch +#: is based on the timestamp of the original MYST Hypercard file: +#: April 21, 1991 9:54AM PST (16:54 UTC) --> Leefo 1, 9647 00:00:00:00 EARTH_EPOCH = datetime(1970, 1, 1, tzinfo=timezone.utc) DNI_EPOCH_EDT = datetime(1991, 4, 21, 16, 54, 0, tzinfo=timezone.utc) # Earth DNI_EPOCH_HAHR = 9647 -# Converted leap seconds to ms, but adjusted for the UNIX epoch instead. -# https://data.iana.org/time-zones/data/leap-seconds.list -# delta_ms_1900_to_1970 = -2208988800000 -# leap_ms = leap_sec_from_ietf * 1000 + delta_ms_1900_to_1970 +#: Converted leap seconds to ms, but adjusted for the UNIX epoch instead. +#: https://data.iana.org/time-zones/data/leap-seconds.list +#: delta_ms_1900_to_1970 = -2208988800000 +#: leap_ms = leap_sec_from_ietf * 1000 + delta_ms_1900_to_1970 LEAP_MS_FROM_EPOCH = [ 63072000000, # 1 Jan 1972 78796800000, # 1 Jul 1972 @@ -96,17 +94,15 @@ LEAP_MS_FROM_EPOCH = [ 1483228800000, # 1 Jan 2017 ] -# A carry-over from the Python datetime module for timedelta objects. Might -# need to adjust if it overflows other values, but it should be okay. +#: A carry-over from the Python datetime module for timedelta objects. Might +#: need to adjust if it overflows other values, but it should be okay. MAX_DNI_DELTA_YAHRTEE = 999999999 -# DniDate.max.to_ordinal() -# (For whatever reason, 5119863 was the former value and I can't figure why. -# Noting it here in case I need it for something.) +#: DniDate.max.to_ordinal() MIN_DNI_ORDINAL = 1 MAX_DNI_ORDINAL = 2900494 -# The names of the 10 vailee in a hahr. +#: The names of the 10 vailee in a hahr. VAILEE_NAMES = [ "Leefo", "Leebro", @@ -120,5 +116,5 @@ VAILEE_NAMES = [ "Leenovoo", ] -# The number of yahrtee (days) before each consectutive vailee (month). +#: The number of yahrtee (days) before each consectutive vailee (month). YAHRTEE_BEFORE_VAILEE = [-1, 0, 29, 58, 87, 116, 145, 174, 203, 232, 261]