1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_STARTTRANSFER_TIME 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_STARTTRANSFER_TIME_T (3) 9 - CURLOPT_TIMEOUT (3) 10 - curl_easy_getinfo (3) 11 - curl_easy_setopt (3) 12Protocol: 13 - All 14--- 15 16# NAME 17 18CURLINFO_STARTTRANSFER_TIME - get the time until the first byte is received 19 20# SYNOPSIS 21 22~~~c 23#include <curl/curl.h> 24 25CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_STARTTRANSFER_TIME, 26 double *timep); 27~~~ 28 29# DESCRIPTION 30 31Pass a pointer to a double to receive the time, in seconds, it took from the 32start until the first byte is received by libcurl. This includes 33CURLINFO_PRETRANSFER_TIME(3) and also the time the server needs to 34calculate the result. 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# EXAMPLE 41 42~~~c 43int main(void) 44{ 45 CURL *curl = curl_easy_init(); 46 if(curl) { 47 CURLcode res; 48 double start; 49 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 50 res = curl_easy_perform(curl); 51 if(CURLE_OK == res) { 52 res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &start); 53 if(CURLE_OK == res) { 54 printf("Time: %.1f", start); 55 } 56 } 57 /* always cleanup */ 58 curl_easy_cleanup(curl); 59 } 60} 61~~~ 62 63# AVAILABILITY 64 65Added in 7.9.2 66 67# RETURN VALUE 68 69Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 70