Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Main
Synchronet
Commits
ab402ebc
Commit
ab402ebc
authored
20 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Clean up internal timer functions.
parent
627f0464
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/odoors/ODPlat.c
+3
-22
3 additions, 22 deletions
src/odoors/ODPlat.c
src/odoors/ODPlat.h
+1
-2
1 addition, 2 deletions
src/odoors/ODPlat.h
with
4 additions
and
24 deletions
src/odoors/ODPlat.c
+
3
−
22
View file @
ab402ebc
...
...
@@ -579,8 +579,7 @@ void ODTimerStart(tODTimer *pTimer, tODMilliSec Duration)
#ifdef ODPLAT_NIX
gettimeofday
(
&
tv
,
NULL
);
pTimer
->
Start_sec
=
tv
.
tv_sec
;
pTimer
->
Start_usec
=
tv
.
tv_usec
;
pTimer
->
Start
=
(
long
long
)
tv
.
tv_sec
*
1000
+
tv
.
tv_usec
/
1000
;
pTimer
->
Duration
=
Duration
;
#endif
}
...
...
@@ -654,19 +653,7 @@ void ODTimerWaitForElapse(tODTimer *pTimer)
#elif defined(ODPLAT_NIX)
/* This is timing sensitive and *MUST* wait regardless of 100% CPU or signals */
while
(
1
)
{
gettimeofday
(
&
tv
,
NULL
);
tv
.
tv_sec
-=
(
pTimer
->
Start_sec
+
pTimer
->
Duration
/
1000
);
tv
.
tv_usec
-=
(
pTimer
->
Start_usec
+
((
pTimer
->
Duration
*
1000
)
%
1000000
));
if
(
tv
.
tv_usec
<
0
)
{
tv
.
tv_sec
--
;
tv
.
tv_usec
+=
1000000
;
}
if
(
tv
.
tv_sec
<
0
||
tv
.
tv_usec
<
0
)
return
;
if
(
!
select
(
0
,
NULL
,
NULL
,
NULL
,
&
tv
))
break
;
}
od_sleep
(
ODTimerLeft
(
pTimer
));
#else
/* !ODPLAT_DOS */
{
/* Under other platforms, timer resolution is high enough that we can */
...
...
@@ -731,13 +718,7 @@ tODMilliSec ODTimerLeft(tODTimer *pTimer)
}
#elif defined(ODPLAT_NIX)
gettimeofday
(
&
tv
,
NULL
);
tv
.
tv_sec
-=
pTimer
->
Start_sec
;
tv
.
tv_usec
-=
pTimer
->
Start_usec
;
if
(
tv
.
tv_usec
<
0
)
{
tv
.
tv_sec
--
;
tv
.
tv_usec
+=
1000000
;
}
left
=
(
tv
.
tv_usec
/
1000
)
+
(
tv
.
tv_sec
*
1000
);
left
=
(
long
long
)
tv
.
tv_sec
*
1000
+
tv
.
tv_usec
/
1000
-
pTimer
->
Start
;
if
(
left
<
0
)
left
=
0
;
return
(
left
);
...
...
This diff is collapsed.
Click to expand it.
src/odoors/ODPlat.h
+
1
−
2
View file @
ab402ebc
...
...
@@ -72,8 +72,7 @@ typedef struct
clock_t
Start
;
clock_t
Duration
;
#elif defined(ODPLAT_NIX)
long
Start_sec
;
long
Start_usec
;
long
long
Start
;
tODMilliSec
Duration
;
#else
/* !ODPLAT_DOS */
tODMilliSec
Start
;
...
...
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