GNURLINFO_...NSFER_TIME(3)

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

okay so bestie, this is the GNURLINFO_...NSFER_TIME(3) page from the curl_easy_getinfo options manual, and we're about to get into timing. No cap, this one is lowkey useful. πŸŽ€

πŸ’– NAME πŸ’–

CURLINFO_PRETRANSFER_TIME β€” get the time until the file transfer start. That's the whole vibe. ✨

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

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

🌸 DESCRIPTION 🌸

Okay so you pass a pointer to a double, and it receives the time, in seconds, it took from the start until the file transfer is just about to begin. Literally the "almost ready, bestie" moment. ⏳

This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved. It does not involve the sending of the protocol-specific request that triggers a transfer.

When a redirect is followed, the time from each request is added together. Yes, summed. πŸŒ€

See also the TIMES overview in the curl_easy_getinfo(3) man page.

πŸ¦‹ PROTOCOLS πŸ¦‹

All β€” every protocol, no gatekeeping. πŸ’…

πŸŽ€ EXAMPLE πŸŽ€

Here's the whole little code moment, copied exactly because we do not mess with code in this house:

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

⭐ AVAILABILITY ⭐

Added in 7.4.1. It's been here a minute, bestie. 🫢

πŸ’… RETURN VALUE πŸ’…

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. That's the whole return-value tea. β˜•

🌈 SEE ALSO 🌈

These are the linked besties, go click around. πŸ’–


mwah πŸ’‹ this page is from libcurl 7.44.0, dated 28 Aug 2015, and it's the GNURLINFO_...NSFER_TIME(3) manual page, bestie. Slay, periodt. πŸ’…

πŸ“¦ where this page comes from