[Date Prev][Date Next]
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
However, if select() returns early due to a signal, the check for how much
remains only computes seconds, not microseconds. The code uses the time()
record when it started waiting and when it stopped. It seems to me that no
has ever asked for greater precision before, but this could easily be fixed
using gettimeofday() instead of time(). Also, some systems (like Linux)
the timeval inside select() automatically, so that when select() returns,
timeval already indicates how much time is left, and no extra compensation
needed by the user-level code. One would have to write a test program for
if they wanted this feature to be detected and used in the library.
-- Howard Chu
Chief Architect, Symas Corp. Director, Highland Sun