Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
4c86dfce
Commit
4c86dfce
authored
Aug 05, 2003
by
Per Cederqvist
Browse files
(timeval_diff_d): New function.
parent
d8b48642
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libraries/libmisc/timeval-util.c
View file @
4c86dfce
...
...
@@ -144,6 +144,12 @@ timeval_diff_sec(struct timeval a, struct timeval b)
return
res
.
tv_sec
+
(
res
.
tv_usec
>=
500000
);
}
double
timeval_diff_d
(
struct
timeval
a
,
struct
timeval
b
)
{
return
(
a
.
tv_sec
-
b
.
tv_sec
)
+
1e-6
*
(
a
.
tv_usec
-
b
.
tv_usec
);
}
int
setup_timer
(
struct
timeval
*
tv
,
struct
timeval
interval
)
...
...
src/libraries/libmisc/timeval-util.h
View file @
4c86dfce
...
...
@@ -42,6 +42,9 @@ extern Bool timeval_less(struct timeval a, struct timeval b);
/* Return the difference as a number of seconds, properly rounded. */
extern
long
timeval_diff_sec
(
struct
timeval
a
,
struct
timeval
b
);
/* Return the difference as a number of seconds, as a double. */
extern
double
timeval_diff_d
(
struct
timeval
a
,
struct
timeval
b
);
/* Set TV to the current time plus INTERVAL. Return -1 if
gettimeofday() fails (check errno). */
extern
int
setup_timer
(
struct
timeval
*
tv
,
struct
timeval
interval
);
Write
Preview
Supports
Markdown
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