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

Manlio Perillo manlio_perillo at libero.it
Sat Jan 10 17:30:32 EST 2009


Mauricio ha scritto:
>>> POSIX realtime extensions have been developed to be high reliable.
>>
>> (...) However, they offer
>> no guarantees on interval measurements, and the correction algorithms
>> can cause the measurement of a time interval of an hour or so duration
>> to be off by +/- 1 sec, especially within the first few hours after a
>> cold boot. (...)
> 
> At the start of this thread, my assumption was that
> all computers had a 100% reliable tick counter. 

High Precision Event Timer (http://en.wikipedia.org/wiki/HPET) should be 
pretty reliable, but it will never be as reliable as a dedicated clock.

> Well,
> this shows I understand nothing about hardware.
> 
> My problem is that the equipment I interact with is
> supposed to deliver data at a constant rate. 

What is the rate value?
How do you read the data?

> Since
> I don't know how much its engineers care about
> patients, I wanted to be sure not to save wrong
> information. 

You should trust the engineers, IMHO, since that is a medical equipment 
and should be more reliable than a PC.

Read carefully the equipment specification.

> It wouldn't matter if the clock is
> saying we are on XVII century, as long as 10 seconds
> would never be 10.1.
> 
> But, as I learned from you, my PC is not to be
> considered as a reference. Maybe the right approach
> is to ask people who understand hardware if mine is
> actually a valid concern.
> 

If you can, you should ask to the equipment producer.
If you are on a POSIX system, store both the time information from the 
equiment and from clock_gettime(CLOCK_MONOTONIC), but only trust the 
equipment.

> Thanks,
> Maurício
> 

Regards  Manlio


More information about the Haskell-Cafe mailing list