GNURLINFO_...ECT_TIME_T(3)
π NAME π
CURLINFO_CONNECT_TIME_T β bestie, this is the one that tells you how long it took to connect, like actually connect, to the remote host. no cap.
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME_T,
curl_off_t *timep);
π¦ DESCRIPTION π¦
okay so here's the vibe π β you pass in a pointer to a curl_off_t, and it gets filled with the total time in microseconds from the start until the connection to the remote host (or proxy) was completed. that's it, that's the whole thing, and honestly? iconic.
the way that redirects work tho β when a redirect is followed, the time from each request is added together. so it's a cumulative situation, not a "just the last one" situation. iykyk π«Ά
also like, pls go peek at the TIMES overview in the curl_easy_getinfo(3) man page, it's the main character of this whole times-adjacent friend group π
π§ PROTOCOLS π§
All π (literally all of them, she does not discriminate, periodt)
π EXAMPLE π
here's the code, exactly as it is, no notes, she ate:
curl = curl_easy_init();
if(curl) {
curl_off_t connect;
curl_easy_setopt(curl, CURLOPT_URL, url);
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &connect);
if(CURLE_OK == res) {
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
(long)(connect % 1000000));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
lowkey obsessed with that /* always cleanup */ comment β she's reminding you to be a responsible lil dev π§Όβ¨
β AVAILABILITY β
Added in 7.61.0 π (yes she's been around, respect her)
π₯ RETURN VALUE π₯
returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if it's not π β so like, check your return codes bestie, don't just vibe and assume.
πΈ SEE ALSO πΈ
and that's the whole page π this was written by the libcurl 7.61.0 girlies, dated 28 Apr 2018 β go forth and time your connects, you gorgeous nerd π«Άβ¨π
π¦ 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