mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-03-26 02:13:19 -04:00
I ported the NOVAS C 3.1 functions julian_date and cal_date to Python, and removed the dependence on the standard datetime class for calculating UT. Now we can create Time objects for a much wider range of year values. Simplified the julian_date formula in C and C#. In the Python version, I had to account for a difference in the way integer division works for negative numbers. In Python, integer division always rounds down, not toward zero like it does in C/C#. So I reworked the formulas to avoid dividing a negative integer (month-14), dividing the positive quantity (14-month) instead and toggling addition of the term with subtraction of the term. I use the reworked (14-month) version in C and C# for consistency. Also, the formatting of the formula was wacky and didn't make sense, so now it easier to read and understand. The Python regex for parsing dates has been expanded to allow years before 0 and after 9999. Allow converting Python Time to string for years before 0 and after 9999.