CURLINFO_TOTAL_TIME_T(3)

πŸ’… CURLINFO_TOTAL_TIME_T(3) πŸ’…

okay so bestie, this one is a libcurl manpage β€” like, from the Library Functions Manual β€” and it's about grabbing the total time of your last transfer. yes, the whole thing. every last microsecond. let's get into it 🫢


✨ NAME ✨

CURLINFO_TOTAL_TIME_T β€” total time of previous transfer


πŸŽ€ SYNOPSIS πŸŽ€

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME_T,
                           curl_off_t *timep);

πŸ’– DESCRIPTION πŸ’–

So here's the vibe: you pass a pointer to a curl_off_t, and it receives the total time in microseconds for the previous transfer β€” and when we say total, we mean total total. name resolving? included. TCP connect? included. the whole journey, no cap. πŸ›«

The curl_off_t represents the time in microseconds. literally that's the unit, bestie.

And when a redirect is followed, the time from each request is added together β€” so it's the sum of the whole little adventure, not just the last hop. the way that adds up 😭

also go peek at the TIMES overview in the curl_easy_getinfo(3) man page, it's giving essential reading πŸ’…

πŸ¦‹ PROTOCOLS πŸ¦‹

This functionality affects all supported protocols. all of them. every single one. periodt 🌈


🌸 EXAMPLE 🌸

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_off_t 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_T, &total);
      if(CURLE_OK == result) {
        printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", total / 1000000,
               (long)(total % 1000000));
      }
    }
    /* always cleanup */
    curl_easy_cleanup(curl);
  }
}

look at that printf doing the microseconds-to-seconds math, absolutely iconic formatting behavior πŸ‘‘


⭐ AVAILABILITY ⭐

Added in curl 7.61.0. so if your curl is older than that, she doesn't know this function and you're gonna have a bad time πŸ’€


🧚 RETURN VALUE 🧚

curl_easy_getinfo(3) returns a CURLcode indicating success or error.

  • CURLE_OK (0) means everything was OK β€” slay πŸ’š
  • non-zero means an error occurred β€” see libcurl-errors(3) for the whole saga

πŸ”₯ SEE ALSO πŸ”₯


k bye bestie, go time your transfers πŸ’œ this page came from libcurl, dated 2026-10-12 β€” mwah, catch you on the next manpage πŸŽ€βœ¨

πŸ“¦ where this page comes from