CURLINFO_STARTTRANSFER_TIME_T(3)

πŸ’… CURLINFO_STARTTRANSFER_TIME_T(3) β€” like, the Library Functions Manual page, bestie ✨

okay so this is the libcurl manual page for CURLINFO_STARTTRANSFER_TIME_T, and no cap it's about to make timing make sense. it's a "Library Functions Manual" situation, so grab a lil snack and let's go πŸ“


🌸 NAME 🌸

CURLINFO_STARTTRANSFER_TIME_T β€” the time it takes to first byte received, literally 🫢


✨ SYNOPSIS ✨

#include <curl/curl.h>

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

πŸ’– DESCRIPTION πŸ’–

so you pass a pointer to a curl_off_t, right? and it receives the time β€” in microseconds ⏱️ β€” that it took from the start until the first byte is received by libcurl. iconic.

and the way this one includes CURLINFO_PRETRANSFER_TIME_T(3) too?? plus the time the server needs to calculate the result. like, it's giving full picture energy, not just the cute little byte moment πŸ’…

when a redirect is followed, the time from each request is added together. every single one. summed. periodt.

also!! go look at the TIMES overview in the curl_easy_getinfo(3) man page, there's a whole vibe check waiting for you there πŸ‘‘


πŸ¦‹ PROTOCOLS πŸ¦‹

this functionality affects all supported protocols β€” all of them, no gatekeeping 🌈


πŸŽ€ EXAMPLE πŸŽ€

okay this is the part where you copy this exactly, i'm serious πŸ™ˆ

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_off_t start;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
    result = curl_easy_perform(curl);
    if(CURLE_OK == result) {
      result = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME_T, &start);
      if(CURLE_OK == result) {
        printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", start / 1000000,
               (long)(start % 1000000));
      }
    }
    /* always cleanup */
    curl_easy_cleanup(curl);
  }
}

see that /* always cleanup */ comment? that's not decoration bestie, that's a lifestyle 🧚


⭐ AVAILABILITY ⭐

added in curl 7.61.0 β€” so it's been around, it's got history, it ate πŸ’€


πŸ‘‘ RETURN VALUE πŸ‘‘

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

  • CURLE_OK (0) means everything was OK β€” slay πŸ’–
  • non-zero means an error occurred β€” not slay 😭 β€” see libcurl-errors(3)

🌟 SEE ALSO 🌟


lowkey reminder: this is genuinely real documentation behaviour, so if your timing math looks weird, go reread the DESCRIPTION, it's all in there fr fr πŸ’œ

k that's the page!! this came from the libcurl manual, dated 2026-10-12, and the page is CURLINFO_S...SFER_TIME_T(3) (yes the header really truncates it like that, we don't make the rules πŸ’…). go get those microseconds, bestie πŸ¦‹βœ¨

πŸ“¦ where this page comes from