From 61ee260aac98028cb46a4be1710194702111ac5b Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 6 Nov 2001 11:11:07 +0000 Subject: [PATCH] [project @ 2001-11-06 11:11:07 by simonmar] - Make the psecs field of a ClockTime measure picoseconds rather than nanoseconds. - toClockTime was throwing away the picoseconds field of the input CalendarTime: fix this. --- ghc/lib/std/Time.hsc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ghc/lib/std/Time.hsc b/ghc/lib/std/Time.hsc index b3440ca..4a9b77e 100644 --- a/ghc/lib/std/Time.hsc +++ b/ghc/lib/std/Time.hsc @@ -1,6 +1,6 @@ -- ----------------------------------------------------------------------------- --- $Id: Time.hsc,v 1.21 2001/09/06 15:38:16 sewardj Exp $ +-- $Id: Time.hsc,v 1.22 2001/11/06 11:11:07 simonmar Exp $ -- -- (c) The University of Glasgow, 1995-2001 -- @@ -208,7 +208,7 @@ getClockTime = do throwErrnoIfMinus1_ "getClockTime" $ gettimeofday p_timeval nullPtr sec <- (#peek struct timeval,tv_sec) p_timeval :: IO CTime usec <- (#peek struct timeval,tv_usec) p_timeval :: IO CTime - return (TOD (fromIntegral sec) ((fromIntegral usec) * 1000)) + return (TOD (fromIntegral sec) ((fromIntegral usec) * 1000000)) #elif HAVE_FTIME getClockTime = do @@ -216,7 +216,7 @@ getClockTime = do ftime p_timeb sec <- (#peek struct timeb,time) p_timeb :: IO CTime msec <- (#peek struct timeb,millitm) p_timeb :: IO CUShort - return (TOD (fromIntegral sec) (fromIntegral msec * 1000{-ToDo: correct???-})) + return (TOD (fromIntegral sec) (fromIntegral msec * 1000000000)) #else /* use POSIX time() */ getClockTime = do @@ -471,7 +471,7 @@ toClockTime (CalendarTime year mon mday hour min sec psec -- gmtoff <- gmtoff p_tm let res = fromIntegral t - tz + fromIntegral gmtoff - return (TOD (fromIntegral res) 0) + return (TOD (fromIntegral res) psec) -- ----------------------------------------------------------------------------- -- Converting time values to strings. -- 1.7.10.4