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
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2023-01-02 20:51:48 +08:00
|
|
|
* Copyright (C) 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
|
|
|
* SPDX-License-Identifier: curl
|
2022-05-17 17:16:50 +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
|
|
|
|
2020-08-29 18:54:30 +08:00
|
|
|
#include "timediff.h"
|
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
|
|
|
/*
|
2023-09-26 03:55:29 +08:00
|
|
|
* Make sure that the first argument (newer) is the more recent time and older
|
|
|
|
* is the older time, as otherwise you get a weird negative time-diff back...
|
2004-04-06 18:15:10 +08:00
|
|
|
*
|
|
|
|
* Returns: the time difference in number of milliseconds.
|
|
|
|
*/
|
2023-09-26 03:55:29 +08:00
|
|
|
timediff_t Curl_timediff(struct curltime newer, struct curltime older);
|
2004-04-09 17:36:31 +08:00
|
|
|
|
|
|
|
/*
|
2023-09-26 03:55:29 +08:00
|
|
|
* Make sure that the first argument (newer) is the more recent time and older
|
|
|
|
* is the older time, as otherwise you get a weird negative time-diff back...
|
|
|
|
*
|
|
|
|
* Returns: the time difference in number of milliseconds, rounded up.
|
|
|
|
*/
|
|
|
|
timediff_t Curl_timediff_ceil(struct curltime newer, struct curltime older);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure that the first argument (newer) is the more recent time and older
|
|
|
|
* 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 */
|