
It looks like CTime (Foreign.C.Types) used to be an Integral but isn't anymore, why? Isn't it just an integer? Frederik -- http://ofb.net/~frederik/

Hello Frederik, Tuesday, May 17, 2005, 7:56:32 AM, you wrote: FE> It looks like CTime (Foreign.C.Types) used to be an Integral but isn't FE> anymore, why? Isn't it just an integer? i also found this problem when switching from 6.2.2 to 6.4, but found some way to walk around it. what is your actual problem? i think that ctime is no more an Integral because you can't add CTime+CTime, nor multiple CTime*CTime and so on - just to catch some possible bugs. but it can be converted to Integral, see at this: modificationTime :: Ptr CStat -> IO ClockTime modificationTime stat = do mtime <- st_mtime stat let realToInteger = round . realToFrac :: Real a => a -> Integer return (TOD (realToInteger (mtime :: CTime)) 0) -- Best regards, Bulat mailto:bulatz@HotPOP.com

On Tue, 17 May 2005 00:27:55 -0700, Bulat Ziganshin
modificationTime :: Ptr CStat -> IO ClockTime modificationTime stat = do mtime <- st_mtime stat let realToInteger = round . realToFrac :: Real a => a -> Integer return (TOD (realToInteger (mtime :: CTime)) 0)
Eek, don't round time, truncate it. It doesn't become 10 o'clock until the minute hand moves all the way back to the twelve. The minute doesn't advance until the second hand moves all the way to the next minute. This is true for any level of precision with time. Dave
participants (3)
-
Bulat Ziganshin
-
David Brown
-
Frederik Eaton