[Haskell-cafe] Re: Can't do basic time operations with System.Time
John Goerzen
jgoerzen at complete.org
Fri Jan 21 16:49:34 EST 2005
On 2005-01-21, Peter Simons <simons at cryp.to> 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.
When you make that assumption, leap seconds suddenly stop mattering :-)
-- John
More information about the Haskell-Cafe
mailing list