6 Jul 01:29
Re: after ids
From: Kevin Kenny <kennykb@...>
Subject: Re: after ids
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-05 23:29:42 GMT
Subject: Re: after ids
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-05 23:29:42 GMT
Donal K. Fellows wrote:
> 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.
Does Darwin support clock_gettime(CLOCK_MONOTONIC, ×pec)?
That's the current OpenGroup thinking, and I do believe that I'd
have the configurator try for that first. (Nope! Looked it
up - MacOSX does not support clock_gettime at all. What *were*
they thinking?)
In any case, on systems where there is no monotonic reference
available (I suspect the other BSD's share the problem with Darwin),
we can fall back on using gettimeofday() as the reference for
relative timers. Darwin is less likely than Windows and Linux to
be deployed in an environnment with no possibility of a working
NTP infrastructure. (How many Apples do you see running factories
or labs?) And it also doesn't have the "guaranteed twice a year"
failure that Windows appears to be prone to. Alex's suggestion
makes things better on Windows and Linux, and does no harm on
HPUX and Solaris. The big hurdle is still autoconf - to recognize
the method to be used, from among
clock_gettime(CLOCK_MONOTONIC, ...)
Solaris, BSD's, newer Linuxes. Solaris needs -lrt or -lposix4
times()
HP-UX (lacks CLOCK_MONOTONIC), older Linuxes, older BSD's, AIX
GetTickCount()
Windows
gettimeofday
Ultimate fallback, no worse than today.
Darwin, others?
I could be all wet about some of these.
--
--
73 de ke9tv/2, Kevin
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
RSS Feed