[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: ldap_result() and timeval



> -----Original Message-----
> From: owner-openldap-software@OpenLDAP.org
> [mailto:owner-openldap-software@OpenLDAP.org]On Behalf Of David Nelson

> Can someone confirm whether ldap_result() only uses the tv_sec member and
> not the tv_usec member while waiting for results.  My testing seems to
> indicate this.
>
> I'm using the 1.2.11 library.

Are you unable to access the library source code yourself, for some reason?

The answer is "maybe" - the entire struct timeval is used by select(), of
course.
However, if select() returns early due to a signal, the check for how much
time
remains only computes seconds, not microseconds. The code uses the time()
call to
record when it started waiting and when it stopped. It seems to me that no
one
has ever asked for greater precision before, but this could easily be fixed
by
using gettimeofday() instead of time(). Also, some systems (like Linux)
update
the timeval inside select() automatically, so that when select() returns,
the
timeval already indicates how much time is left, and no extra compensation
is
needed by the user-level code. One would have to write a test program for
configure
if they wanted this feature to be detected and used in the library.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc