On 21 January 2005 21:50, John Goerzen wrote:
> On 2005-01-21, Peter Simons <[EMAIL PROTECTED]> wrote:
>>> 24 * ((fromIntegral $ tdDay td) +
>>> 30 * ((fromIntegral $ tdMonth td) +
>>> 365 * (fromIntegral $ tdYear td)))))
>>
>> I was wondering: Does this calculation account for leap
>> years? Does it have to?
>
> I also wondered about all months being 30 days. But this exact
> algorithm is used in fptools' normalizeTimeDiff, and it seems to work
> out correctly, so I guess the timeDiff functions assume that every
> month has 30 days and every year has 365.
normalizeTimeDiff (and TimeDiff in general) is wrong. I wouldn't
recommend using it. There's the TimeExts library in the lang package,
which might be useful to you.
Cheers,
Simon
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe