Re: after ids
- From: "Donal K. Fellows" <donal.k.fellows@xxxxxxxxx>
- Date: Sat, 5 Jul 2008 10:58:06 -0700 (PDT)
Kevin Kenny wrote:
Many people here are unquestionably arguing from ignorance, but I do
suspect after some conversations with Alexandre Ferrieux that they
are onto something with wanting a distinction between absolute and
relative times.
While I could always see how to do it with single sets of timers, I
could never work out how to do it reliably with multiple event
sequences on different scales (e.g. a 13ms interval and a 1s interval)
where the event processing takes an appreciable time w.r.t. the
shorter intervals. Which happens for sure when using, say, Tk; redraws
are quite expensive. With each pending timer event assigned an
absolute time at which it becomes eligible for execution, it's pretty
simple to handle. But without it...
I - and apparently you, Donal - had long believed that no portable
way existed to get such a clock, but I am coming to suspect that the
world is catching up with our needs. On Windows, the information is
available with the GetTickCount function, which has existed since the
beginning (Windows attempts to calibrate its rate to NTP corrections,
but guarantees its monotonicity except for the 49.7-day rollover,
which we could deal with easily). Unix-like systems are a tougher
nut to crack, but with the Posix standards being implemented more and
more widely, I suspect that the times() function is a reasonable
reference on Unix-like systems.
Alas, no. On Darwin[*], times() is documented as returning the number
of clock ticks since the Unix epoch, and so is inherently coupled to
absolute time. It's also deprecated in favour of gettimeofday() (and
getrusage(), but that's by the by).
Without a monotonic reference, the problem's just about impossible
without doing something elaborate with a RTOS.
Donal.
[* I read this in the manual pages on Leopard... ]
.
- Follow-Ups:
- Re: after ids
- From: slebetman@xxxxxxxxx
- Re: after ids
- From: Kevin Kenny
- Re: after ids
- References:
- Re: after ids
- From: Fredderic
- Re: after ids
- From: Alexandre Ferrieux
- Re: after ids
- From: Donald Arseneau
- Re: after ids
- From: Donal K. Fellows
- Re: after ids
- From: Kevin Kenny
- Re: after ids
- Prev by Date: Re: newbie
- Next by Date: Re: after ids
- Previous by thread: Re: after ids
- Next by thread: Re: after ids
- Index(es):
Relevant Pages
|