GNURLINFO_TOTAL_TIME(3)
β¨ GNURLINFO_TOTAL_TIME β¨
okay so real quick before we dive in: this page lives in the curl_easy_getinfo options part of the manual (yes the header literally says GNURLINFO_TOTAL_TIME(3), we're being so consistent today π
). it's a tiny page, it's an icon, and it will tell you exactly how long your transfer took. let's go bestie π«Ά
πΈ NAME πΈ
CURLINFO_TOTAL_TIME β get the total time of the previous transfer, no cap β±οΈ
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME, double
*timep);
π DESCRIPTION π
so what you do is: pass a pointer to a double, and it gets filled in with the total time in seconds for the previous transfer. and when we say total, we mean total β that includes name resolving, TCP connect, all of it. the whole journey bestie βοΈ
the double represents the time in seconds, and yes, it includes fractions. so 0.482 is a legit answer, don't be weird about it π
when a redirect is followed, the time from each request gets added together. so it's cumulative, it stacks, it's giving β¨collectionβ¨
also, lowkey important: see the TIMES overview in the curl_easy_getinfo(3) man page. it's the mothership, go look at it π
π PROTOCOLS π
All β literally every protocol, we love an inclusive queen π
π EXAMPLE π
here's the whole thing in action, copy it, run it, live your truth:
curl = curl_easy_init();
if(curl) {
double 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, &total);
if(CURLE_OK == res) {
printf("Time: %.1f", total);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
notice the /* always cleanup */ comment? that's not decoration bestie, curl_easy_cleanup(curl); is mandatory. main character energy means cleaning up after yourself π§Ήπ
β AVAILABILITY β
added in 7.4.1 β an elder, a legend, we stan a veteran π
π RETURN VALUE π
- returns
CURLE_OKif the option is supported β slay, you're good π - returns
CURLE_UNKNOWN_OPTIONif it's not β rip, it's not a thing here π
π₯ SEE ALSO π₯
ngl the_Tvariant in SEE ALSO is thecurl_off_tsibling, so if you're the type to go look at the other pages (you are, bestie, i know you), go look at the other pages π«Ά
and that's the page!! this one came to you from libcurl 7.44.0, dated 28 Aug 2015 β a vintage moment, honestly, iconic, 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