It applies to houses purchased after the end of this year:
Actually it applies to SALES after the end of this year. It applies to ALL homes, even those bought before 2009. However the clock for counting the number of days of non-qualified use starts Jan 1, 2009.
The taxable gain is Dnon/Dtot
where Dnon is the number of days of non-qualified use after Jan 1, 2009. Dtot is the total number of days used (assuming you lived in it as a primary residence in 2 out of 5 years).
I am sure people will be confused by this for the next several years. I bet that they eventually just “simplify” it in a way that results in higher taxes.