Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Barchiesi
OpenLDAP
Commits
53664cb8
Commit
53664cb8
authored
16 years ago
by
Quanah Gibson-Mount
Browse files
Options
Downloads
Patches
Plain Diff
ITS#5668
parent
032292e5
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGES
+1
-0
1 addition, 0 deletions
CHANGES
libraries/liblutil/utils.c
+25
-14
25 additions, 14 deletions
libraries/liblutil/utils.c
with
26 additions
and
14 deletions
CHANGES
+
1
−
0
View file @
53664cb8
...
...
@@ -3,6 +3,7 @@ OpenLDAP 2.4 Change Log
OpenLDAP 2.4.12 Engineering
Fixed libldap TLS_CRLFILE (ITS#5677)
Fixed liblutil executables on Windows (ITS#5604)
Fixed liblutil microsecond overflows on Windows (ITS#5668)
Fixed librewrite memory handling (ITS#5691)
Fixed slapd aci performance (ITS#5636)
Fixed slapd aci's with sets (ITS#5627)
...
...
This diff is collapsed.
Click to expand it.
libraries/liblutil/utils.c
+
25
−
14
View file @
53664cb8
...
...
@@ -303,41 +303,52 @@ lutil_gettime( struct lutil_tm *tm )
GetSystemTime
(
&
st
);
QueryPerformanceCounter
(
&
count
);
/* It shouldn't ever go backwards, but multiple CPUs might
* be able to hit in the same tick.
*/
if
(
count
.
QuadPart
<=
prevCount
.
QuadPart
)
{
subs
++
;
}
else
{
subs
=
0
;
prevCount
=
count
;
}
/* We assume Windows has at least a vague idea of
* when a second begins. So we align our microsecond count
* with the Windows millisecond count using this offset.
* We retain the submillisecond portion of our own count.
*
* Note - this also assumes that the relationship between
* the PerformanceCouunter and SystemTime stays constant;
* that assumption breaks if the SystemTime is adjusted by
* an external action.
*/
if
(
!
cFreq
.
QuadPart
)
{
long
long
t
;
int
usec
;
QueryPerformanceFrequency
(
&
cFreq
);
t
=
count
.
QuadPart
*
1000000
;
t
/=
cFreq
.
QuadPart
;
usec
=
t
%
10000000
;
usec
/=
1000
;
offset
=
(
usec
-
st
.
wMilliseconds
)
*
1000
;
}
/* just get sub-second portion of counter */
t
=
count
.
QuadPart
%
cFreq
.
QuadPart
;
/* It shouldn't ever go backwards, but multiple CPUs might
* be able to hit in the same tick.
*/
if
(
count
.
QuadPart
<=
prevCount
.
QuadPart
)
{
subs
++
;
}
else
{
subs
=
0
;
prevCount
=
count
;
/* convert to microseconds */
t
*=
1000000
;
usec
=
t
/
cFreq
.
QuadPart
;
offset
=
usec
-
st
.
wMilliseconds
*
1000
;
}
tm
->
tm_usub
=
subs
;
/* convert to microseconds */
count
.
QuadPart
%=
cFreq
.
QuadPart
;
count
.
QuadPart
*=
1000000
;
count
.
QuadPart
/=
cFreq
.
QuadPart
;
count
.
QuadPart
-=
offset
;
tm
->
tm_usec
=
count
.
QuadPart
%
1000000
;
if
(
tm
->
tm_usec
<
0
)
tm
->
tm_usec
+=
1000000
;
/* any difference larger than microseconds is
* already reflected in st
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment