News for hackers. Stuff that matters.
Re:Ask HN: Did you encounter any leap year bugs today? by drdeca on Friday March 01, 2024 @01:05AM (#39559019)
Take DOB + n * 365.25 and then pick whatever day that falls in? That way it shouldn’t drift overall. Though, I guess it would imply that what day of the year people celebrate on, would be off by one day on leap years compared to what it is on other years?
Re:Ask HN: Did you encounter any leap year bugs today? by iforgotpassword on Friday March 01, 2024 @01:57AM (#39559293)
This formula doesn't consider how we sometimes skip leap years, and sometimes have leap seconds, so it's vastly imprecise.
Re:Ask HN: Did you encounter any leap year bugs today? by munch117 on Friday March 01, 2024 @02:20AM (#39559421)
So make it more precise. DOB + n * 365.2421.
Re:Ask HN: Did you encounter any leap year bugs today? by histories on Friday March 01, 2024 @03:45AM (#39559899)
365.2425
Re:Ask HN: Did you encounter any leap year bugs today? by shzhdbi09gv8ioi on Friday March 01, 2024 @04:58AM (#39560279)
365.2421 is more correct.

Nasa explains:

365 +0.25 - 0.01 + 0.0025 - 0.00025 = 365.24225

https://pumas.nasa.gov/examples/how-many-days-are-year

Re:Ask HN: Did you encounter any leap year bugs today? by histories on Friday March 01, 2024 @06:56AM (#39560922)
>Omitting a leap year every 4000 years

Wait, is this right? omitting every 100 and adding every 400 should be enough.

EDIT: the 4000-year rule is just a proposal for now. So 365.2425 is correct.

Re:Ask HN: Did you encounter any leap year bugs today? by mark-r on Friday March 01, 2024 @08:24AM (#39561527)
None of us will live long enough to see the 4000-year rule become a problem. I don't even expect to be around for the next 100-year rule.