CURLINFO_TOTAL_TIME(3)
β¨ CURLINFO_TOTAL_TIME(3) β¨
okay so bestie, welcome to the CURLINFO_TOTAL_TIME page π
this is one of those little gems living in the libcurl Library Functions Manual, and honestly? she's a vibe. let's get into it π«Ά
πΈ NAME πΈ
CURLINFO_TOTAL_TIME β the total time of the previous transfer, bestie. that's it, that's the whole thing π
π¦ SYNOPSIS π¦
the way you gotta include this first, no skipping:
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME, double *timep);
π DESCRIPTION π
okay so here's the tea β you pass a pointer to a double, and that double gets filled with the total time in seconds for the previous transfer β and like, all of it bestie. name resolving? in there. TCP connect? in there too. etc, etc, the whole journey π
the double represents the time in seconds, including fractions β so like, yes, you get the decimals, she's precise π
and when a redirect is followed, the time from each request is added together β so no sneaky hidden time, it all stacks up, no cap π₯
also!! go check the TIMES overview in the curl_easy_getinfo(3) man page, iykyk π
π§ PROTOCOLS π§
this functionality affects all supported protocols β every single one, she's versatile like that β
π EXAMPLE π
here's the code, copy it exactly bestie, don't be out here freestyling:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
double total;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
result = curl_easy_perform(curl);
if(CURLE_OK == result) {
result = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total);
if(CURLE_OK == result) {
printf("Time: %.1f", total);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
look at that printf("Time: %.1f", total); β she's printing the time, she's living her best life π and yeah, /* always cleanup */ is literally in the comments because we always cleanup, periodt π
π AVAILABILITY π
added in curl 7.4.1 β she's been iconic since day one π
π RETURN VALUE π
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK(0) means everything was OK β we love a zero π- non-zero means an error occurred, see
libcurl-errors(3)β not the vibe, but at least you'll know π
π₯ SEE ALSO π₯
ok that's the whole page bestie, go get those timings and slay π β¨
libcurl Β· 2026-10-12 Β· mwah, kiss kiss, that's the sign-off π«Άπππ¦
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms