CURLINFO_P...FER_TIME_T(3)
π CURLINFO_POSTTRANSFER_TIME_T β bestie's guide to timing
okay so this one is from the Library Functions Manual (libcurl girlies rise up β¨) and it's all about how long it took to get that last byte out the door. Let's go π
β¨ NAME β¨
CURLINFO_POSTTRANSFER_TIME_T β the time it took to send the last byte, periodt π
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_POSTTRANSFER_TIME_T,
curl_off_t *timep);
β¨ DESCRIPTION β¨
So here's the vibe π¦ β you pass a pointer to a curl_off_t, and it receives the time, in microseconds, that it took from the start until the last byte is sent by libcurl. Literally the moment the very last byte leaves the building π.
And when a redirect is followed? Not me forgetting β the time from each request is added together, fr fr. Every hop counts π«Ά.
Also lowkey go look at the TIMES overview in the curl_easy_getinfo(3) man page, iykyk.
π PROTOCOLS π
This functionality affects all supported protocols β she's versatile, she contains multitudes β¨
πΈ EXAMPLE πΈ
like, here's how you'd actually use her:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
result = curl_easy_perform(curl);
if(CURLE_OK == result) {
curl_off_t posttransfer;
result = curl_easy_getinfo(curl, CURLINFO_POSTTRANSFER_TIME_T,
&posttransfer);
if(CURLE_OK == result) {
printf("Request sent after: %" CURL_FORMAT_CURL_OFF_T ".%06ld s",
posttransfer / 1000000, (long)(posttransfer % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
(and yes bestie, /* always cleanup */ is non-negotiable β curl_easy_cleanup(curl) always π
)
β AVAILABILITY β
Added in curl 8.10.0 β she's a newer icon, born in 8.10.0, respect her π
π RETURN VALUE π
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK β slay π
. Anything non-zero means an error occurred, so go see libcurl-errors(3) and figure out what went wrong π.
π¦ SEE ALSO π¦
ngl, microseconds are tiny but this info is main character energy β measure your sends, know your timing π₯
later besties π this page was brought to you by libcurl, dated 2026-10-12, straight out of the Library Functions Manual β mwah π«Άβ¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms