Commit 44d594c7 authored by Andrew Wood's avatar Andrew Wood Committed by Keith Bennett

Fix count of leap years since 1970

Years 1700, 1800, 1900 didn't occur after 1970, so the term
"- (year - 1601)/100" was subtracting too many leap years.
parent 8302c75f
......@@ -45,7 +45,11 @@ CONTAINS
m = values(6) - values(4)
s = values(7)
days = (year - 1970)*365 + (year - 1969)/4 + days_since_new_year(month)
days = (year - 1970)*365 & ! 365 days per year
+ (year - 1969)/4 & ! and an extra day for each leap year
- (year - 1601)/100 + 3 & ! but century years are not leap years
+ (year - 1601)/400 & ! unless divisible by 400
+ days_since_new_year(month)
IF ((MOD(year,400) == 0 &
.OR. (MOD(year,4) == 0 .AND. MOD(year,100) /= 0)) &
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment