CURLINFO_FILETIME_T(3)
π CURLINFO_FILETIME_T(3) β like, the libcurl manual, bestie π
okay so picture this: you're deep in the Library Functions Manual section of the libcurl pages, and you just found the one that tells you when a remote file was last touched. iconic behavior only. let's go β¨
πΈ NAME πΈ
CURLINFO_FILETIME_T β the remote time of the retrieved resource, but make it 64-bit-safe π
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME_T,
curl_off_t *timep);
β¨ DESCRIPTION β¨
so basically π β you pass in a pointer to a curl_off_t, and it receives the remote time of the document you just retrieved. that's the number of seconds since January 1 1970, in the GMT/UTC time zone. periodt.
if you get back -1, don't panic π β there are like a million reasons that can happen. it might just be unknown, the server might be hiding it from you (rude), or the server might not even support the command that reports document time, etc etc. either way, the time of the document is unknown. that's it, that's the whole vibe.
β οΈ bestie, listen β you must ask libcurl to collect this info before the transfer is made, by using theCURLOPT_FILETIME(3)option. if you don't, you unconditionally get a-1back. no cap. π
and here's the slay π
β this option is an alternative to CURLINFO_FILETIME(3), specifically so that systems with 32 bit long variables can still extract dates outside of the 32-bit timestamp range. it's giving "we thought of everything." π§
π PROTOCOLS π
this functionality affects ftp, http and sftp π₯
π EXAMPLE π
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
/* Ask for filetime */
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
result = curl_easy_perform(curl);
if(CURLE_OK == result) {
curl_off_t filetime;
result = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime);
if((CURLE_OK == result) && (filetime != -1)) {
time_t file_time = (time_t)filetime;
printf("filetime: %s", ctime(&file_time));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
like, look at her go ππ she sets the URL, asks for the filetime, performs, then grabs the curl_off_t and prints it with ctime. main character energy fr fr.
π«Ά AVAILABILITY π«Ά
added in curl 7.59.0 β
π RETURN VALUE π
curl_easy_getinfo(3) returns a CURLcode that indicates success or error.
CURLE_OK(0) means everything was OK π- non-zero means an error occurred β go check
libcurl-errors(3)π
π SEE ALSO π
okay that's the whole page, you ate that π½οΈβ¨ go forth and timestamp responsibly. this little love letter comes to you from libcurl, dated 2026-10-12, and it's forever filed under CURLINFO_FILETIME_T(3) π
ππ¦π
π¦ 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