Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-camogm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-camogm
Commits
c6891c7f
Commit
c6891c7f
authored
May 23, 2017
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: add time subtraction function
parent
ecb78ce2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
thelper.c
src/thelper.c
+19
-0
thelper.h
src/thelper.h
+1
-0
No files found.
src/thelper.c
View file @
c6891c7f
...
...
@@ -51,3 +51,22 @@ int time_comp(struct timeval *t1, struct timeval *t2)
}
return
-
1
;
}
/**
* Subtract one time value from another and return the difference
* @param tv1 time value to subtract from
* @param tv2 time value to be subtracted
* @return tv1 - tv2
*/
struct
timeval
time_sub
(
const
struct
timeval
*
tv1
,
const
struct
timeval
*
tv2
)
{
struct
timeval
ret_val
=
*
tv1
;
ret_val
.
tv_sec
-=
1
;
ret_val
.
tv_usec
+=
1000000
;
ret_val
.
tv_sec
-=
tv2
->
tv_sec
;
ret_val
.
tv_usec
-=
tv2
->
tv_usec
;
time_normalize
(
&
ret_val
);
return
ret_val
;
}
src/thelper.h
View file @
c6891c7f
...
...
@@ -26,5 +26,6 @@
void
time_normalize
(
struct
timeval
*
tv
);
int
time_comp
(
struct
timeval
*
t1
,
struct
timeval
*
t2
);
struct
timeval
time_sub
(
const
struct
timeval
*
tv1
,
const
struct
timeval
*
tv2
);
#endif
/* _THELPER_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment