CTime problem

David Brown haskell at davidb.org
Tue May 17 12:07:53 EDT 2005


On Tue, 17 May 2005 00:27:55 -0700, Bulat Ziganshin <bulatz at HotPOP.com>  
wrote:

> 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


More information about the Libraries mailing list