
21 Jan
2005
21 Jan
'05
1:08 p.m.
John Goerzen writes:
timeDiffToSecs :: TimeDiff -> Integer timeDiffToSecs td = (fromIntegral $ tdSec td) + 60 * ((fromIntegral $ tdMin td) + 60 * ((fromIntegral $ tdHour td) + 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? As I see it, it's not possible to convert a TimeDiff accurately without knowing the point in time from which to "diff" from. How many days is "4 years from now"? It's almost certainly not 4*365 days. Uh, did I mention leap seconds? ;-) Peter