1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-12 12:35:04 -05:00

add tutil_tvdiff_secs() for completeness

This commit is contained in:
Yang Tse 2007-02-20 01:09:38 +00:00
parent c11681becd
commit da8c666e4f
2 changed files with 18 additions and 0 deletions

View File

@ -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)
{

View File

@ -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);