GNURLINFO_FILETIME(3)
π GNURLINFO_FILETIME(3) π
hiii bestie!! welcome to GNURLINFO_FILETIME(3) β the page living its best life in the curl_easy_getinfo options manual. grab a strawberry π and let's get into it.
β¨ NAME β¨
CURLINFO_FILETIMEβ get the remote time of the retrieved document
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME, long *timep);
π DESCRIPTION π
okay so you pass a pointer to a long, and it receives the remote time of the retrieved document. that's the number of seconds since 1 jan 1970 in the GMT/UTC time zone, periodt. π
if you get -1, it can be because of many reasons (it might be unknown, the server might hide it or the server doesn't support the command that tells document time etc) and the time of the document is unknown. not the vibe, but that's the deal.
bestie, you must tell libcurl to collect this information before the transfer is made, by using theCURLOPT_FILETIME(3)option tocurl_easy_setopt(3)β or you will unconditionally get a-1back. no cap. π«Ά
also consider using CURLINFO_FILETIME_T(3) to be able to extract dates beyond the year 2038 on systems using 32 bit longs. future-proofing slay β¨
π PROTOCOLS π
HTTP(S), FTP(S), SFTP
π EXAMPLE π
here's the example, literally untouched so you can copy it and go:
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, url);
/* Ask for filetime */
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
if((CURLE_OK == res) && (filetime >= 0)) {
time_t file_time = (time_t)filetime;
printf("filetime %s: %s", filename, ctime(&file_time));
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
β AVAILABILITY β
Added in 7.5.
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
π SEE ALSO π
mwah π β this lil page is from libcurl 7.44.0, dated 28 Aug 2015, and yes bestie, it's GNURLINFO_FILETIME(3). bye π«Ά
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2018, 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