GNURLINFO_...FER_TIME_T(3)
π GNURLINFO_...FER_TIME_T π
okay so listen bestie, this is a page from the curl_easy_getinfo options manual, and it's genuinely one of the cutest little stats you can pull out of libcurl. it's giving stopwatch energy, fr fr. let's get into it π
β¨ NAME β¨
CURLINFO_STARTTRANSFER_TIME_T β get the time until the first byte is received πβ¨
πΈ SYNOPSIS πΈ
#include <gnurl/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. that's the whole vibe. β±οΈ
and bestie, it's not just the transfer β this number includes CURLINFO_PRETRANSFER_TIME_T(3) and also the time the server needs to calculate the result. so it's the full "waiting for the server to get its life together" moment π«Ά
heads up: when a redirect is followed, the time from each request is added together. no cap, it just stacks. π
also see the TIMES overview in the curl_easy_getinfo(3) man page if you wanna go deeper, iykyk π
π¦ PROTOCOLS π¦
All β literally all of them, slay π
π EXAMPLE π
curl = curl_easy_init();
if(curl) {
curl_off_t 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_T, &start);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", start / 1000000,
(long)(start % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
look at her go π§ dividing by 1000000 to get seconds, modding by 1000000 for the microsecond bits β iconic math, no notes π
β AVAILABILITY β
Added in 7.61.0 π
π₯ RETURN VALUE π₯
returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. that's it, that's the check π
π SEE ALSO π
and that's the whole page bestie!! this one's from libcurl 7.61.0, dated 28 Apr 2018, and it lives in the GNURLINFO_...FER_TIME_T(3) section of the manual πβ¨ mwah, go time some transfers π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 2018 - 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