You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.9 KiB
51 lines
1.9 KiB
2 years ago
|
#ifndef HEADER_CURL_TIMEDIFF_H
|
||
|
#define HEADER_CURL_TIMEDIFF_H
|
||
6 years ago
|
/***************************************************************************
|
||
|
* _ _ ____ _
|
||
|
* Project ___| | | | _ \| |
|
||
|
* / __| | | | |_) | |
|
||
|
* | (__| |_| | _ <| |___
|
||
|
* \___|\___/|_| \_\_____|
|
||
|
*
|
||
2 years ago
|
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||
6 years ago
|
*
|
||
|
* This software is licensed as described in the file COPYING, which
|
||
|
* you should have received as part of this distribution. The terms
|
||
3 years ago
|
* are also available at https://curl.se/docs/copyright.html.
|
||
6 years ago
|
*
|
||
|
* 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
|
||
|
* furnished to do so, under the terms of the COPYING file.
|
||
|
*
|
||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||
|
* KIND, either express or implied.
|
||
|
*
|
||
|
***************************************************************************/
|
||
2 years ago
|
|
||
6 years ago
|
#include "curl_setup.h"
|
||
|
|
||
2 years ago
|
/* Use a larger type even for 32 bit time_t systems so that we can keep
|
||
|
microsecond accuracy in it */
|
||
|
typedef curl_off_t timediff_t;
|
||
|
#define CURL_FORMAT_TIMEDIFF_T CURL_FORMAT_CURL_OFF_T
|
||
|
|
||
|
#define TIMEDIFF_T_MAX CURL_OFF_T_MAX
|
||
|
#define TIMEDIFF_T_MIN CURL_OFF_T_MIN
|
||
|
|
||
|
/*
|
||
|
* Converts number of milliseconds into a timeval structure.
|
||
|
*
|
||
|
* Return values:
|
||
|
* NULL IF tv is NULL or ms < 0 (eg. no timeout -> blocking select)
|
||
|
* tv with 0 in both fields IF ms == 0 (eg. 0ms timeout -> polling select)
|
||
|
* tv with converted fields IF ms > 0 (eg. >0ms timeout -> waiting select)
|
||
|
*/
|
||
|
struct timeval *curlx_mstotv(struct timeval *tv, timediff_t ms);
|
||
6 years ago
|
|
||
2 years ago
|
/*
|
||
|
* Converts a timeval structure into number of milliseconds.
|
||
|
*/
|
||
|
timediff_t curlx_tvtoms(struct timeval *tv);
|
||
6 years ago
|
|
||
2 years ago
|
#endif /* HEADER_CURL_TIMEDIFF_H */
|