Code covered by the BSD License  

Highlights from
Calculate Time Interval/ Difference

Calculate Time Interval/ Difference

by

 

01 Nov 2010 (Updated )

To compute time interval, taking into account leap days that are subsumed within that interval.

leapDayHasPassed( month, day)
function hasPassed = leapDayHasPassed( month, day)
%LEAPDAYHASPASSED assumes that the year is a leap year
% hasPassed = {0, 1} = {false, true}

if (month < 2)
    hasPassed = 0;
    return;
elseif (month > 2)
    hasPassed = 1;
    return;
else % (month) == feb
   hasPassed = 0;
   return;
%     if (day < 29)
%         hasPassed = 0;
%         return;
%     else % it is the leap day !
%         hasPassed = 0;
%         return;        
%     end
end

end

Contact us