RFC: Time Library 0.2

Sebastian Sylvan sebastian.sylvan at gmail.com
Tue Nov 1 10:18:02 EST 2005


On 11/1/05, Bulat Ziganshin <bulatz at hotpop.com> wrote:
> Hello Sebastian,
>
> Tuesday, November 01, 2005, 5:21:44 PM, you wrote:
>
> SS> I sometimes need wall-clock time with very high precision. To meassure
>
> i use the following:
>
> diffTimes (TOD sa pa) (TOD sb pb)  =  fromIntegral(sa - sb) + (fromIntegral(pa-pb) / 1e12)
>
> -- Number of seconds since oprogram start
> return_real_secs = do
>   start_time    <- readIORef refClockTimeAtProgramStart
>   current_time  <- getClockTime
>   return $ diffTimes current_time start_time
>
>
> of course, it's a hack using internal details of current library and i
> also need the function which will return high-precision wall-clock
> time
>

Well, on my system, System.Time has a resolution of 16ms, which is terrible.

So we need a function that uses the various high performance counters
that each architecture exposes to get high-precison results.

/S

--
Sebastian Sylvan
+46(0)736-818655
UIN: 44640862


More information about the Libraries mailing list