master
Peter Hinch 2023-12-16 19:11:46 +00:00
rodzic 0062b0f9a1
commit f9107de893
2 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -126,6 +126,10 @@ time (`MT`).
not computed, saving some processor time. Offsets are positive numbers
representing degrees below the horizon where twilight is deemed to start and end.
By default when an application instantiates `RiSet` for the first time the
constructor prints the system date and time. This can be inhibited by setting
the class variable `verbose` to `False`.
## 2.2 Methods
* `set_day(day: int = 0)` `day` is an offset in days from the current system

Wyświetl plik

@ -201,6 +201,8 @@ def minimoon(t):
class RiSet:
verbose = True
def __init__(self, lat=LAT, long=LONG, lto=0, tl=None): # Local defaults
self.sglat = sin(radians(lat))
self.cglat = cos(radians(lat))
@ -213,6 +215,10 @@ class RiSet:
# [sunrise, sunset, moonrise, moonset, cvend, cvstart]
self._times = [None] * 6
self.set_day() # Initialise to today's date
if RiSet.verbose:
t = time.localtime()
print(f"Machine time: {t[2]:02}/{t[1]:02}/{t[0]:4} {t[3]:02}:{t[4]:02}:{t[5]:02}")
RiSet.verbose = False
# ***** API start *****
# Examine Julian dates either side of current one to cope with localtime.