Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
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
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
da8c666e
Commit
da8c666e
authored
18 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
add tutil_tvdiff_secs() for completeness
parent
c11681be
No related branches found
Branches containing commit
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
tests/libtest/testutil.c
+11
-0
11 additions, 0 deletions
tests/libtest/testutil.c
tests/libtest/testutil.h
+7
-0
7 additions, 0 deletions
tests/libtest/testutil.h
with
18 additions
and
0 deletions
tests/libtest/testutil.c
+
11
−
0
View file @
da8c666e
...
...
@@ -98,6 +98,17 @@ long tutil_tvdiff(struct timeval newer, struct timeval older)
(
newer
.
tv_usec
-
older
.
tv_usec
)
/
1000
;
}
/*
* Same as tutil_tvdiff but with full usec resolution.
*
* Returns: the time difference in seconds with subsecond resolution.
*/
double
tutil_tvdiff_secs
(
struct
timeval
newer
,
struct
timeval
older
)
{
return
(
double
)(
newer
.
tv_sec
-
older
.
tv_sec
)
+
(
double
)(
newer
.
tv_usec
-
older
.
tv_usec
)
/
1000000
.
0
;
}
/* return the number of seconds in the given input timeval struct */
long
tutil_tvlong
(
struct
timeval
t1
)
{
...
...
This diff is collapsed.
Click to expand it.
tests/libtest/testutil.h
+
7
−
0
View file @
da8c666e
...
...
@@ -56,6 +56,13 @@ struct timeval tutil_tvnow(void);
*/
long
tutil_tvdiff
(
struct
timeval
t1
,
struct
timeval
t2
);
/*
* Same as tutil_tvdiff but with full usec resolution.
*
* Returns: the time difference in seconds with subsecond resolution.
*/
double
tutil_tvdiff_secs
(
struct
timeval
t1
,
struct
timeval
t2
);
long
tutil_tvlong
(
struct
timeval
t1
);
...
...
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