Hi Stefano,
you are right, there is a bug in the calculation of the days since 01.01.1970.
The correct calculation is: days = (year + 30) * 365 + (year + 27) / 4;
30 years (1970..1999) without additional leap year days
+ leap year days begining from 1972 (year + 28 - 1) / 4
The -1 is because we have to add the additional day one year after the leap year.
This will work till year 2100 which is exceptioally no leap year.