3 ms·
How are these things happening? in Australia our Healthcare system had a bug too: http://www.itnews.com.au/News/292081,hicaps-bug-hits-health-payment-system.asp
by xelfer 15y ago
How are these things happening? in Australia our Healthcare system had a bug too: http://www.itnews.com.au/News/292081,hicaps-bug-hits-health-payment-system.aspx http://www.itnews.com.au/News/292081,hicaps-bug-hits-health-...
I don't recall any of this occurring in 2008 or 2004.
- RandallBrown 15y agoThis happens all the time because of how confusing our calendar is. Lots of dates are figured out by counting the number of seconds since 1970. It's really easy to miss a little detail like a leap year, since they happen so infrequently and they didn't always exist. It's not just Microsoft that does stuff like this either. Apple regularly messes up iPhone alarms during daylight savings.
- crcastle 15y agoDivisible by 4 => leap year Also divisible by 100 => not leap year unless also divisible by 400. It's really not that complicated. [edit: Oops. I messed it up. Irony. Fixed now.]
- yuliyp 15y agoAlso divisible by 100 => not leap year unless also divisible by 400. Complicated enough to mess up.
- nkassis 15y agoCheck out wikipedia's page I just noticed they have the algorithm spelled out in pseudocode ;p http://en.wikipedia.org/wiki/Leap_year http://en.wikipedia.org/wiki/Leap_year What baffles me is did they really have to rewrite that again somewhere else? Don't they have libraries in whatever language they are using with something to do the date calculations they need?
- notatoad 15y agowhy is anybody even doing these calculations? import an existing datetime library and use it. these problems have been solved, and tested in previous leap years. what's the point in re-solving it?
- mrb 15y agoThis is not an irony that you messed it up. You provide the perfect example why these bugs happen: not only you didn't know the exact rules (divisibility by 400), but you also thought it would be fine to implement them yourself, when you should most likely use an existing library to handle date & time calculations.
- apaprocki 15y ago... and most people don't realize that knowing that correct calculation is only half the battle. Once you know it, you can successfully navigate the Gregorian calendar. But what happens when you need to work with dates prior to the start of the Gregorian calendar? Does your Gregorian start happen in 1582 when the first countries adopted it, or in 1752 when the British adopted it? Most people simply apply Gregorian rules indefinitely into the past, which is not always correct for every situation: http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar