2012-12-28 19:03:09 +08:00
|
|
|
#ifndef HEADER_CURL_TIMEVAL_H
|
|
|
|
#define HEADER_CURL_TIMEVAL_H
|
2002-09-03 19:52:59 +08:00
|
|
|
/***************************************************************************
|
2004-11-05 00:14:33 +08:00
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
1999-12-29 22:20:26 +08:00
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2020-11-05 15:22:10 +08:00
|
|
|
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
1999-12-29 22:20:26 +08:00
|
|
|
*
|
2002-09-03 19:52:59 +08:00
|
|
|
* This software is licensed as described in the file COPYING, which
|
|
|
|
* you should have received as part of this distribution. The terms
|
2020-11-04 21:02:01 +08:00
|
|
|
* are also available at https://curl.se/docs/copyright.html.
|
2004-11-05 00:14:33 +08:00
|
|
|
*
|
2001-01-03 17:29:33 +08:00
|
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
* copies of the Software, and permit persons to whom the Software is
|
2002-09-03 19:52:59 +08:00
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
1999-12-29 22:20:26 +08:00
|
|
|
*
|
2001-01-03 17:29:33 +08:00
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
1999-12-29 22:20:26 +08:00
|
|
|
*
|
2002-09-03 19:52:59 +08:00
|
|
|
***************************************************************************/
|
1999-12-29 22:20:26 +08:00
|
|
|
|
2013-01-07 02:06:49 +08:00
|
|
|
#include "curl_setup.h"
|
2000-08-24 22:28:11 +08:00
|
|
|
|
2019-07-31 21:30:31 +08:00
|
|
|
/* Use a larger type even for 32 bit time_t systems so that we can keep
|
|
|
|
microsecond accuracy in it */
|
2017-10-26 19:02:00 +08:00
|
|
|
typedef curl_off_t timediff_t;
|
2019-01-02 06:04:57 +08:00
|
|
|
#define CURL_FORMAT_TIMEDIFF_T CURL_FORMAT_CURL_OFF_T
|
2019-07-31 21:30:31 +08:00
|
|
|
|
|
|
|
#define TIMEDIFF_T_MAX CURL_OFF_T_MAX
|
|
|
|
#define TIMEDIFF_T_MIN CURL_OFF_T_MIN
|
2017-10-23 18:05:49 +08:00
|
|
|
|
2017-07-28 21:49:36 +08:00
|
|
|
struct curltime {
|
2017-10-23 18:05:49 +08:00
|
|
|
time_t tv_sec; /* seconds */
|
|
|
|
int tv_usec; /* microseconds */
|
2017-07-28 21:49:36 +08:00
|
|
|
};
|
|
|
|
|
2017-10-25 17:59:43 +08:00
|
|
|
struct curltime Curl_now(void);
|
2001-10-12 20:32:20 +08:00
|
|
|
|
2004-04-06 18:15:10 +08:00
|
|
|
/*
|
|
|
|
* Make sure that the first argument (t1) is the more recent time and t2 is
|
|
|
|
* the older time, as otherwise you get a weird negative time-diff back...
|
|
|
|
*
|
|
|
|
* Returns: the time difference in number of milliseconds.
|
|
|
|
*/
|
2017-10-23 18:05:49 +08:00
|
|
|
timediff_t Curl_timediff(struct curltime t1, struct curltime t2);
|
2004-04-09 17:36:31 +08:00
|
|
|
|
|
|
|
/*
|
2017-06-07 19:16:56 +08:00
|
|
|
* Make sure that the first argument (t1) is the more recent time and t2 is
|
|
|
|
* the older time, as otherwise you get a weird negative time-diff back...
|
2004-04-09 17:36:31 +08:00
|
|
|
*
|
2017-06-07 19:16:56 +08:00
|
|
|
* Returns: the time difference in number of microseconds.
|
2004-04-09 17:36:31 +08:00
|
|
|
*/
|
2017-10-23 18:05:49 +08:00
|
|
|
timediff_t Curl_timediff_us(struct curltime newer, struct curltime older);
|
2004-04-06 18:15:10 +08:00
|
|
|
|
2012-12-28 19:03:09 +08:00
|
|
|
#endif /* HEADER_CURL_TIMEVAL_H */
|