Playstation network outage

Kind of ironic. Remember this?

It was the day that all Microsoft Zunes (Microsoft’s iPod imitator) broke.
The problem? Microsoft incorrectly coded the date function, which would break on the last day of every leap year.
So, that happened on the 31st of December 2008. Zune’s wouldn’t boot (read my link for information on why, and the code in question. It’s a very interesting read – Basically it has to do with Microsoft’s code giving an error because in 2008 there were 366 days).
Anyway. What was Microsoft’s solution? To wait until the 1st of January 2009, where things would auto-fix themselves.
Nice…… I remember heavily criticizing this, but, in reality, producing an actual fix for the problem would have taken (including testing) a lot more than 24 hours. By waiting, the problem was still there, but wouldn’t manifest itself for another 4 years. Even Microsoft can release before 2012 🙂
Well, guess what? Sony made the same mistake with the Sony PS3 (It makes me sad, as I’m a big Sony fan, and I thought Sony were better than that.)
Sony made almost the same mistake. Rather than mess up on the last day of every leap year, Sony’s PS3 (though this only affect the older PHAT model) messed up on the 1st of March 2010. I don’t have access to the code in question (and AFAIK it hasn’t been posted) but here’s my best guess as to what’s going on.
Basically, the PS3 is incorrectly assuming 2010 to be a leap year.
Because of this, it calculates (which is correct, based on the false assumption) the 60th day of the year to be the 29th of February (rather than correctly calculating that 2010 is NOT a leap year, thereby correctly realizing that the 60th day of the year is in fact the 1st of March 2010).
Now, this isn’t exactly right, as if this were the case, the problem wouldn’t have fixed itself on the 2nd of March. (if my assumption was correct, the error would have propagated, and the PS3 would have continued assuming each day was 1 number higher than it really was, but unless Sony says otherwise, this is a close approximation to the problem)
Interesting, right?
These types of problems (bugs?) are called corner cases. This basically means that the bug only manifests itself in a few rare instances, making it much harder to track. In the case of a leap year, the problems tends to only show up every 4 years, making it easy to miss.
I’m pretty sure Microsoft, Nintendo and Sony are all going to do a significant review of their date handling code after this 🙂
As a side note, during a Q&A with sony, sony said the following:
Q. Do I have to download a firmware update?

A. Nope. The problem should just fix itself automatically, whether you’re online or not

So, lets analyse this for a second. You don’t need to download a fix. It will fix itself.

It’s pretty obvious what happened. Sony pulled a Microsoft. They didn’t fix the problem at all. They just waited until the 2nd of March to claim to have fixed the problem. The fact that you don’t need to be online means they didn’t actually fix anything. Still, I’m sure they’ll release an update to actually fix the problem before 2012.

The biggest problem here is the new PS3 exclusive title “Heavy Rain”
Heavy Rain just came out, and people are associating the problem with the game with the flawed argument “As soon as I started playing this game, my systems broke”

Lets all look at the correct way to determine a leap year with the accepted psuedo code:

if year divided by 400 is 0
<div>
  <span style="white-space: pre;"> </span>then is_leap_year
</div>

<div>
  else if year divided by 100 is 0
</div>

<div>
  <span style="white-space: pre;"> </span>then not_leap_year
</div>

<div>
  else if year divided by 4 is 0
</div>

<div>
  <span style="white-space: pre;"> </span>then is_leap_year
</div>

<div>
  else
</div>

<div>
  <span style="white-space: pre;"> </span>not_leap_year
</div>