GNURLINFO_TOTAL_TIME_T(3)
okay bestie, welcome to GNURLINFO_TOTAL_TIME_T(3) β a page straight out of the curl_easy_getinfo options manual, and the main character is literally CURLINFO_TOTAL_TIME_T β±οΈβ¨
β¨ NAME β¨
CURLINFO_TOTAL_TIME_T β get the total time of the previous transfer in microseconds. that's the whole vibe, no cap π
π¦ SYNOPSIS π¦
okay so you include this and call it like this:
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME_T,
curl_off_t *timep);
πΈ DESCRIPTION πΈ
you pass a pointer to a curl_off_t, and it receives the total time in microseconds for the previous transfer, including name resolving, TCP connect etc. β yes, the whole little journey π«Ά The curl_off_t represents the time in microseconds, fr fr.
When a redirect is followed, the time from each request is added together. so if it hops around, those request times stack up together π«
also peek at the TIMES overview in the curl_easy_getinfo(3) man page. iykyk π
π PROTOCOLS π
All. literally all of them, no protocol left behind πβ¨
π EXAMPLE π
here's the example, untouched because we respect the code around here:
curl = curl_easy_init();
if(curl) {
curl_off_t total;
curl_easy_setopt(curl, CURLOPT_URL, url);
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &total);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", total / 1000000,
(long)(total % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
π AVAILABILITY π
Added in 7.61.0. so like, that's when it showed up β¨
π₯ RETURN VALUE π₯
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. slay π
π SEE ALSO π
go peek at these too, bestie:
kisses and sparkles π«Ά this page is from libcurl 7.61.0, dated 28 Apr 2018, and yes it's still giving GNURLINFO_TOTAL_TIME_T(3) energy πππ¦
π¦ 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