title: Calculating number of days between two dates that are in a leap year
body: <p>Given two dates, what is the best method to calculate the number of days between those two dates that fall in a leap year.  </p>
  
  <p>For example if d1 = 12/1/2007 and d2 = 1/31/2008 then the total number of days between d1 and d2 would be 62 and the number of days that fall in a leap year would be 31.  </p>
  
  <p>Another example is if d1 = 12/1/2007 and d2 = 6/30/2012 then the total number of days between d1 and d2 would be 1674 and the number of days that fall in a leap year would be 548.</p>
  
  <p>I already have function to calculate if a specific year is a leap year and and a function to calculate the number of days between two dates.</p>
  
  <p>If anyone has such a algorithm in Delphi (Pascal) or C/C++/C# that would be greatly appreciated.  Any suggestions and assistance would be great.</p>