GNURLINFO_...NSFER_TIME(3)
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
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms