GNURLINFO_...NSFER_TIME(3)

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

πŸ‘‘ GNURLINFO_...NSFER_TIME(3) β€” bestie, this is your girl's guide to CURLINFO_STARTTRANSFER_TIME ✨

okay so real talk, this page lives in the curl_easy_getinfo options section of the manual, and the whole thing is filed under <rainbow>GNURLINFO_...NSFER_TIME(3) β€” yes the title is truncated, no it's not a typo, the manual page name generator just did That πŸ’… anyway. sit down, grab a strawberry drink πŸ“, we're timing bytes.


🌸 NAME 🌸

CURLINFO_STARTTRANSFER_TIME β€” literally the get-the-time-until-the-first-byte-is-received girlie πŸ’–

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_STARTTRANSFER_TIME,
double *timep);

πŸ¦‹ DESCRIPTION πŸ¦‹

so what you're doing here is passing a pointer to a double, and that double is gonna be filled in with the time β€” in seconds ⏱️ β€” that it took from the very start until the first byte was received by libcurl. no cap.

and it's not just some lone number, bestie: this time includes CURLINFO_PRETRANSFER_TIME(3) (yes, the whole pretransfer moment) and it also includes the time the server needs to actually calculate the result. the server was doing its little math homework and we're counting it πŸ“šβœ¨

🌈 oh and heads up: when a redirect is followed, the time from each request is added together. every hop counts, no skipping.

also go peek at the TIMES overview in the curl_easy_getinfo(3) man page if you want the full timeline lore, iykyk.

πŸŽ€ PROTOCOLS πŸŽ€

All of them. every single one. main character protocol energy πŸ‘‘

πŸ”₯ EXAMPLE πŸ”₯

curl = curl_easy_init();
if(curl) {
  double start;
  curl_easy_setopt(curl, CURLOPT_URL, url);
  res = curl_easy_perform(curl);
  if(CURLE_OK == res) {
    res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &start);
    if(CURLE_OK == res) {
      printf("Time: %.1f", start);
    }
  }
  /* always cleanup */
  curl_easy_cleanup(curl);
}

not the /* always cleanup */ comment being the most responsible thing on this whole page 😭 yes bestie, curl_easy_cleanup(curl); β€” always. periodt.

πŸ’œ AVAILABILITY πŸ’œ

Added in 7.9.2 β€” vintage icon behavior, honestly.

⭐ RETURN VALUE ⭐

  • Returns CURLE_OK if the option is supported ✨
  • and CURLE_UNKNOWN_OPTION if it's not πŸ™ˆ

🫢 SEE ALSO 🫢


okay that's the whole page, you ate that πŸ½οΈπŸ’… go time some bytes β€” this was libcurl 7.44.0, dated 28 Aug 2015, filed under GNURLINFO_...NSFER_TIME(3), mwah 😘✨

πŸ“¦ where this page comes from