GNURLINFO_TOTAL_TIME_T(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

okay bestie, welcome to GNURLINFO_TOTAL_TIME_T(3) β€” a page straight out of the curl_easy_getinfo options manual, and the main character is literally CURLINFO_TOTAL_TIME_T ⏱️✨


✨ NAME ✨

CURLINFO_TOTAL_TIME_T β€” get the total time of the previous transfer in microseconds. that's the whole vibe, no cap πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

okay so you include this and call it like this:

#include <gnurl/curl.h>

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

🌸 DESCRIPTION 🌸

you pass a pointer to a curl_off_t, and it receives the total time in microseconds for the previous transfer, including name resolving, TCP connect etc. β€” yes, the whole little journey 🫢 The curl_off_t represents the time in microseconds, fr fr.

When a redirect is followed, the time from each request is added together. so if it hops around, those request times stack up together πŸ’«

also peek at the TIMES overview in the curl_easy_getinfo(3) man page. iykyk πŸ‘‘

🌈 PROTOCOLS 🌈

All. literally all of them, no protocol left behind πŸ‘‘βœ¨

πŸŽ€ EXAMPLE πŸŽ€

here's the example, untouched because we respect the code around here:

curl = curl_easy_init();
if(curl) {
  curl_off_t total;
  curl_easy_setopt(curl, CURLOPT_URL, url);
  res = curl_easy_perform(curl);
  if(CURLE_OK == res) {
    res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &total);
    if(CURLE_OK == res) {
      printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", total / 1000000,
             (long)(total % 1000000));
    }
  }
  /* always cleanup */
  curl_easy_cleanup(curl);
}

πŸ’œ AVAILABILITY πŸ’œ

Added in 7.61.0. so like, that's when it showed up ✨

πŸ”₯ RETURN VALUE πŸ”₯

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. slay πŸ’…

🌟 SEE ALSO 🌟

go peek at these too, bestie:


kisses and sparkles 🫢 this page is from libcurl 7.61.0, dated 28 Apr 2018, and yes it's still giving GNURLINFO_TOTAL_TIME_T(3) energy πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from