CURLINFO_CONNECT_TIME(3)
π CURLINFO_CONNECT_TIME(3) β time to connect β¨
okay bestie, so this is a libcurl manual page (Library Functions Manual, iykyk) and it's literally all about finding out how long the connect took. buckle up π
πΈ NAME πΈ
CURLINFO_CONNECT_TIME β time to connect, periodt π
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME, double *timep);
π¦ DESCRIPTION π¦
Okay so here's the vibe: you pass a pointer to a double, and curl fills it with the total time in seconds from the start until the connection to the remote host (or proxy, no cap) was completed. β±οΈπ
And when a redirect is followed? The time from each request gets added together. all of them. stacked. the whole journey π₯
π also pls go look at the TIMES overview in the curl_easy_getinfo(3) man page, it's giving main character energy and it's lowkey essential reading π«Ά
π PROTOCOLS π
This functionality affects all supported protocols β¨ (yes, all of them, we love range π)
π EXAMPLE π
here's the whole thing, character for character, go off bestie:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
double connect;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
result = curl_easy_perform(curl);
if(CURLE_OK == result) {
result = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &connect);
if(CURLE_OK == result) {
printf("Time: %.1f", connect);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
π§ AVAILABILITY π§
Added in curl 7.4.1 β a certified classic, we stan a veteran π π
β RETURN VALUE β
curl_easy_getinfo(3) returns a CURLcode indicating success or error, that's the whole deal π
CURLE_OK(0) means everything was OK π slay- non-zero means an error occurred π see
libcurl-errors(3)for the full breakdown
π SEE ALSO π
π and that's the page!! brought to you by libcurl, dated 2026-10-12 β go time your connects bestie, 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