mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-10 14:23:34 -05:00
ITS#9513 If lucky enough to land in the same µs, increment counter even if we count in ns
This commit is contained in:
parent
0ef0bf4d8c
commit
3d36ac523d
1 changed files with 3 additions and 1 deletions
|
|
@ -311,12 +311,14 @@ ldap_pvt_gettime( struct lutil_tm *ltm )
|
|||
time_t t;
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
#define FRAC tv_nsec
|
||||
#define USECS(x) x / 1000
|
||||
#define NSECS(x) x
|
||||
struct timespec tv;
|
||||
|
||||
clock_gettime( CLOCK_REALTIME, &tv );
|
||||
#else
|
||||
#define FRAC tv_usec
|
||||
#define USECS(x) x
|
||||
#define NSECS(x) x * 1000
|
||||
struct timeval tv;
|
||||
|
||||
|
|
@ -327,7 +329,7 @@ ldap_pvt_gettime( struct lutil_tm *ltm )
|
|||
LDAP_MUTEX_LOCK( &ldap_int_gettime_mutex );
|
||||
if ( tv.tv_sec < _ldap_pvt_gt_prevTv.tv_sec
|
||||
|| ( tv.tv_sec == _ldap_pvt_gt_prevTv.tv_sec
|
||||
&& tv.FRAC <= _ldap_pvt_gt_prevTv.FRAC )) {
|
||||
&& USECS(tv.FRAC) <= USECS(_ldap_pvt_gt_prevTv.FRAC) )) {
|
||||
_ldap_pvt_gt_subs++;
|
||||
} else {
|
||||
_ldap_pvt_gt_subs = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue