[Libevent-users] Re: evtimer complains...

Phil Oleson oz at nixil.net
Tue Dec 12 00:04:26 EST 2006


Ya.. I think some better documentation is in order.. I also am thinking
that you might want to convert gettime() to evgettime() and export it
for use with the library to keep those that might have a system that
doesn't have CLOCK_MONOTONIC, which defaults to CLOCK_REALTIME or even
defaults to gettimeofday() (all possible scenarios depending on the
system), in order to have a common way to manipulate timers that match
libevent. I've satisfied my questions.. and used a relative timer in my
code.

	-Phil.


Niels Provos wrote:
> The libevent API has never supported absolute times for timeouts.  If
> they worked before then that was only by accident and never by
> intention.  The switch to clock monotonic was made to support clock
> resets.   So, personally, I am very surprised that absolute times ever
> worked for you.
> 
> Is this something that should be documented more clearly in the man page?
> 
> Niels.
> 
> On 12/9/06, Phil Oleson <oz at nixil.net> wrote:
>> Niels,
>>
>>         I've taken a little time time to look through my issue with
>> evtimers.  Previously, Scott Lamb questioned my code using absolute
>> time with evtimers, but I see no problem with this.  It used to work
>> pre-1.2, and I've tracked the issue down to gettime() using
>> CLOCK_MONOTONIC rather than CLOCK_REALTIME. When I've hacked libevent to
>> use CLOCK_REALTIME, my test code works.  To me it seems that using
>> CLOCK_MONOTONIC causes issues with calls to gettimeofday.  Was there
>> any particular reason to have CLOCK_MONOTONIC as the arg to
>> clock_gettime()?  I would just like to understand this better before
>> I rewrite my application.
>>
>>         -Phil.
>>
>>



More information about the Libevent-users mailing list