1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_PRETRANSFER_TIME 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_CONNECT_TIME_T (3) 9 - CURLINFO_PRETRANSFER_TIME_T (3) 10 - curl_easy_getinfo (3) 11 - curl_easy_setopt (3) 12--- 13 14# NAME 15 16CURLINFO_PRETRANSFER_TIME - get the time until the file transfer start 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME, 24 double *timep); 25~~~ 26 27# DESCRIPTION 28 29Pass a pointer to a double to receive the time, in seconds, it took from the 30start until the file transfer is just about to begin. 31 32This time-stamp includes all pre-transfer commands and negotiations that are 33specific to the particular protocol(s) involved. It includes the sending of 34the protocol-specific instructions that trigger a transfer. 35 36When a redirect is followed, the time from each request is added together. 37 38See also the TIMES overview in the curl_easy_getinfo(3) man page. 39 40# PROTOCOLS 41 42All 43 44# EXAMPLE 45 46~~~c 47int main(void) 48{ 49 CURL *curl = curl_easy_init(); 50 if(curl) { 51 CURLcode res; 52 double pretransfer; 53 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 54 res = curl_easy_perform(curl); 55 if(CURLE_OK == res) { 56 res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &pretransfer); 57 if(CURLE_OK == res) { 58 printf("Time: %.1f", pretransfer); 59 } 60 } 61 /* always cleanup */ 62 curl_easy_cleanup(curl); 63 } 64} 65~~~ 66 67# AVAILABILITY 68 69Added in 7.4.1 70 71# RETURN VALUE 72 73Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 74