2012-12-28 15:03:09 +04:00
|
|
|
#ifndef HEADER_CURL_TIMEVAL_H
|
|
|
|
#define HEADER_CURL_TIMEVAL_H
|
2002-09-03 15:52:59 +04:00
|
|
|
/***************************************************************************
|
2004-11-04 19:14:33 +03:00
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
1999-12-29 17:20:26 +03:00
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2019-01-02 01:04:57 +03:00
|
|
|
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
|
1999-12-29 17:20:26 +03:00
|
|
|
*
|
2002-09-03 15:52:59 +04:00
|
|
|
* This software is licensed as described in the file COPYING, which
|
|
|
|
* you should have received as part of this distribution. The terms
|
2016-02-03 02:19:02 +03:00
|
|
|
* are also available at https://curl.haxx.se/docs/copyright.html.
|
2004-11-04 19:14:33 +03:00
|
|
|
*
|
2001-01-03 12:29:33 +03: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 15:52:59 +04:00
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
1999-12-29 17:20:26 +03:00
|
|
|
*
|
2001-01-03 12:29:33 +03:00
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
1999-12-29 17:20:26 +03:00
|
|
|
*
|
2002-09-03 15:52:59 +04:00
|
|
|
***************************************************************************/
|
1999-12-29 17:20:26 +03:00
|
|
|
|
2013-01-06 22:06:49 +04:00
|
|
|
#include "curl_setup.h"
|
2000-08-24 18:28:11 +04:00
|
|
|
|
2017-10-23 13:05:49 +03:00
|
|
|
#if SIZEOF_TIME_T < 8
|
|
|
|
typedef int timediff_t;
|
2019-01-02 01:04:57 +03:00
|
|
|
#define CURL_FORMAT_TIMEDIFF_T "d"
|
2017-10-23 13:05:49 +03:00
|
|
|
#else
|
2017-10-26 14:02:00 +03:00
|
|
|
typedef curl_off_t timediff_t;
|
2019-01-02 01:04:57 +03:00
|
|
|
#define CURL_FORMAT_TIMEDIFF_T CURL_FORMAT_CURL_OFF_T
|
2017-10-23 13:05:49 +03:00
|
|
|
#endif
|
|
|
|
|
2017-07-28 16:49:36 +03:00
|
|
|
struct curltime {
|
2017-10-23 13:05:49 +03:00
|
|
|
time_t tv_sec; /* seconds */
|
|
|
|
int tv_usec; /* microseconds */
|
2017-07-28 16:49:36 +03:00
|
|
|
};
|
|
|
|
|
2017-10-25 12:59:43 +03:00
|
|
|
struct curltime Curl_now(void);
|
2001-10-12 16:32:20 +04:00
|
|
|
|
2004-04-06 14:15:10 +04: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 13:05:49 +03:00
|
|
|
timediff_t Curl_timediff(struct curltime t1, struct curltime t2);
|
2004-04-09 13:36:31 +04:00
|
|
|
|
|
|
|
/*
|
2017-06-07 14:16:56 +03: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 13:36:31 +04:00
|
|
|
*
|
2017-06-07 14:16:56 +03:00
|
|
|
* Returns: the time difference in number of microseconds.
|
2004-04-09 13:36:31 +04:00
|
|
|
*/
|
2017-10-23 13:05:49 +03:00
|
|
|
timediff_t Curl_timediff_us(struct curltime newer, struct curltime older);
|
2004-04-06 14:15:10 +04:00
|
|
|
|
2012-12-28 15:03:09 +04:00
|
|
|
#endif /* HEADER_CURL_TIMEVAL_H */
|