CURLOPT_FILETIME(3)
π CURLOPT_FILETIME π
okay so bestie, welcome to the CURLOPT_FILETIME page β that's the libcurl manual, third section, and it's literally all about getting the modification time of a remote thing. yes. timestamps. we love a timestamp. π°οΈβ¨
β¨ NAME β¨
CURLOPT_FILETIME β get the modification time of the remote resource π
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FILETIME, long gettime);
πΈ DESCRIPTION πΈ
so you pass a long, right? and if that long is 1, libcurl tries to get the modification time of the remote document in this operation. highkey main character behavior. π
but like β heads up β this requires that the remote server actually sends the time, or replies to a time querying command. so it's giving "hope for the best," not "guaranteed." π
then, after a transfer, you can hit up curl_easy_getinfo(3) with the CURLINFO_FILETIME(3) argument to extract the received time (if any). "if any" is doing a lot of work in that sentence, iykyk. π
π¦ DEFAULT π¦
0
(not me, not asking, not caring β unless you say so π )
π PROTOCOLS π
this functionality affects file, ftp, http, sftp and smb β five icons, all iconic, no cap. β
π EXAMPLE π
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/path.html");
/* Ask for filetime */
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
result = curl_easy_perform(curl);
if(CURLE_OK == result) {
long filetime;
result = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
if((CURLE_OK == result) && (filetime >= 0)) {
time_t file_time = (time_t)filetime;
printf("filetime: %s", ctime(&file_time));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
like, look at her go π«Ά ask for the filetime, do the transfer, pull the info, print it with ctime, then clean up. /* always cleanup */ is the golden rule bestie, don't forget it π
π§ AVAILABILITY π§
Added in curl 7.5 β vintage, but make it cute. π
π₯ RETURN VALUE π₯
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK β slay. β¨ non-zero means an error occurred, so go check libcurl-errors(3). not the vibe, but at least you'll know what's up π
π SEE ALSO π
and that's the whole page, bestie!! brought to you by libcurl, dated 2026-10-12 β mwah, go get those timestamps ππ¦β¨
π¦ 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