5 Jul 18:56
Re: after ids
From: Kevin Kenny <kennykb@...>
Subject: Re: after ids
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-05 16:56:23 GMT
Subject: Re: after ids
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-05 16:56:23 GMT
Donal K. Fellows wrote: > OK, how do you work out how long until the next event fires without an > absolute time source? For added bonus points, do so with arbitrary > real-time delays between processing points and without extra threads. Donal, 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. Absolute time, as far as Tcl is concerned, is UTC with smoothing (http://www.cl.cam.ac.uk/~mgk25/uts.txt). It advances monotonically and (more or less) continuously, ticking at an uneven rate to accommodate TAI-UTC differences and NTP corrections. It *can* be nonmonotonic or discontinuous in unusual circumstances, owing to an act of God (a network outage causing too large an NTP jump to recover by advancing or retarding clock frequency), an act of the operator (adjusting system time by the wristwatch-(Continue reading)and- -eyeball method), or an Act of Congress (Daylight Saving Time, on operating systems that use civil time as the reference). Its reference on Unix-like systems is gettimeofday(); on Windows systems its ultimate reference is the system clock returned by GetSystemTimeAsFileTime, with additional precision provided by interpolation using the performace counter. Relative time is not something that Tcl currently recognises, but perhaps should. It is strictly monotonic and uniform;
> Darwin has pthread_cond_timedwait_relative_np() for exactly this
> purpose, I don't know if other systems have something equivalent.
Don't know either but please notice that going to select() everywhere
would solve the problem uniformly. The non-threaded unix notifer has
no problem with relative timers, it's just that currently the value is
recomputed based on absolute time when it needs be.
> (converting next absolute timer fire to a relative
> time interval may result in waiting for too long if there are changes
RSS Feed