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