periodic 'at'

Marc Lehmann schmorp at
Wed Feb 25 07:30:44 CET 2009

On Tue, Feb 24, 2009 at 08:38:42PM -0600, Garrett Smith <g at> wrote:
> First, I think the documentation is a bit off -- it uses some of the
> terms used by timers (after and repeat). Not a biggie. 

It seems this is only in the shown prototype of ev_periodic_set, right? Other
uses of the terms seem to be correct.

> The docs seem to imply that the 'at' argument used in ev_periodic_init
> can be used to start the periodic at some point in the future: 

This depends on the mode, as documented (there are three modes, only the
absolute timer mode does this).

> Looking in the source, though, it looks like 'at' is a calculated
> value that isn't used in the init. The 'at' argument is actually used
> for 'offset'. The behavior that I've seen supports the source :)

What do you mean with that? There is no "offset" argument in the source,
there is only an offset member in the watcher, and that one seems to be
documented correctly.

But "at" and "offset" are different things - one is the argument to
ev_periodic_init, the other is a struct member - different names,
different locations, different purposes.

> Should it be possible to provide both 'at' and 'offset'?

Towards what end?

> Without getting into the manual mode, it would be useful to schedule a
> repeating timer to fire at some point in the future.

You can do that already without manual mode - you can reprogram the periodic
as you want, if the existing mdoes are not enough.

Having a completely different starting point and offset is not implemented
and would require more members (to store this extra starting point) and an
ABI change. It would also complicate usage of the periodics further.

I don't see a use case for this scenario that you cannot simply replace
by reprogramming the watcher on the fly, resulting in a simpler and more
usable periodic.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list