DeaD_EyE

Moon position in °

Jul 6th, 2022 (edited)
133
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None
  1. # not sure if this is correct
  2.  
  3. import datetime
  4.  
  5. def position(now=None):
  6.    if now is None:
  7.       now = datetime.datetime.now()
  8.  
  9.    days = (now - datetime.datetime(2001, 1, 1)) / datetime.timedelta(days=1)
  10.    lunations = float.fromhex("0x1.a29b0e8eb915ep-3") + days * float.fromhex("0x1.1568432488c6ap-5")
  11.  
  12.    return round((lunations % 1) * 360)
  13.  
RAW Paste Data Copied