1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_TOTAL_TIME 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_TOTAL_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_TOTAL_TIME - get total time of previous transfer 19 20# SYNOPSIS 21 22~~~c 23#include <curl/curl.h> 24 25CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME, double *timep); 26~~~ 27 28# DESCRIPTION 29 30Pass a pointer to a double to receive the total time in seconds for the 31previous transfer, including name resolving, TCP connect etc. The double 32represents the time in seconds, including fractions. 33 34When a redirect is followed, the time from each request is added together. 35 36See also the TIMES overview in the curl_easy_getinfo(3) man page. 37 38# EXAMPLE 39 40~~~c 41int main(void) 42{ 43 CURL *curl = curl_easy_init(); 44 if(curl) { 45 CURLcode res; 46 double total; 47 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 48 res = curl_easy_perform(curl); 49 if(CURLE_OK == res) { 50 res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total); 51 if(CURLE_OK == res) { 52 printf("Time: %.1f", total); 53 } 54 } 55 /* always cleanup */ 56 curl_easy_cleanup(curl); 57 } 58} 59~~~ 60 61# AVAILABILITY 62 63Added in 7.4.1 64 65# RETURN VALUE 66 67Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 68