[Haskell-cafe] Re: Computer time, independent of date

Manlio Perillo manlio_perillo at libero.it
Fri Jan 9 10:45:40 EST 2009

John Goerzen ha scritto:
> 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_MONOTONIC, in particular, looks suitable.  Using it could be a
> matter of just a few quick likes in FFI.

There is also an available package on Hackage: posix-realtime.

> I don't know if Windows has similar features.

and QueryPerformanceCounter, in detail.

Unfortunately, documentation is really bad, and it is not really clear 
what "high-resolution performance counter" means.

> -- John

Manlio Perillo

More information about the Haskell-Cafe mailing list