Here's a basic draft project for clock_gettime(CLOCK_MONOTONIC, ...)
http://sert.homedns.org/hs/mnsec/
http://sert.homedns.org/hs/mnsec/dist/mnsec-1.0.0.tar.gz

It could be extended to cover other clock types than just monotonic.

Regards,
CS

2009/1/9 John Goerzen <jgoerzen@complete.org>
Steve Schafer wrote:
> On Fri, 09 Jan 2009 11:01:18 -0200, you wrote:
>
>> I'm writing a program that will read medical signs
>>from many patients. It's important to have a precise
>> measure of the time interval between some signs, and
>> that can't depend on adjustments of time. (Supose
>> my software is running midnight at the end of a year
>> with leap seconds. I would get wrong time intervals.)
>
> If you really need that level of accuracy, there is nothing available on
> an off-the-shelf machine that will do the job. You need an independent
> timekeeping source of some kind, one that is not subject to the vagaries

I'm not sure that the original question implied *that* level of need.

Linux has High-Resolution Timers (HRTs) that may be appropriate.  See
the manpage for clock_gettime(), which defines these HRTs:

      CLOCK_REALTIME
             System-wide real-time clock.  Setting this clock requires
appropriate privi-
             leges.

      CLOCK_MONOTONIC
             Clock  that  cannot be set and represents monotonic time
since some unspeci-
             fied starting point.

      CLOCK_PROCESS_CPUTIME_ID
             High-resolution per-process timer from the CPU.

      CLOCK_THREAD_CPUTIME_ID
             Thread-specific CPU-time clock.

CLOCK_MONOTONIC, in particular, looks suitable.  Using it could be a
matter of just a few quick likes in FFI.

I don't know if Windows has similar features.

-- John
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe