GNURLOPT_FILETIME(3)
π GNURLOPT_FILETIME(3) β the group-chat guide
okay so bestie, this one is from the curl_easy_setopt options family (the gnurl flavor, specifically) and it's lowkey one of the cutest little flags ever. it's giving "can u pls tell me when this file was last touched" energy. π
β¨ NAME β¨
CURLOPT_FILETIME β get the modification time of the remote resource π°οΈ
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FILETIME, long gettime);
πΈ DESCRIPTION πΈ
so you pass a long in here, right? if it's 1, libcurl will attempt to get the modification time of the remote document in this operation. attempt is the key word bestie β this requires that the remote server actually sends the time, or replies to a time querying command. no cap, the server has to cooperate. π
then, after the transfer, you can call curl_easy_getinfo(3) with the CURLINFO_FILETIME(3) argument to extract the received time (if any). the "(if any)" is doing a lot of heavy lifting there, just saying. π
π DEFAULT π
0
π PROTOCOLS π
HTTP, FTP, SFTP, FILE
π₯ EXAMPLE π₯
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 π§
always, babes β and for SFTP since 7.49.0 β
π RETURN VALUE π
returns CURLE_OK π
π«Ά SEE ALSO π«Ά
and that's the whole vibe! π no drama, no surprises, just a lil time query slay. this page came to you courtesy of libcurl 7.37.0, dated 17 Jun 2014 β like, a vintage. iconic behavior honestly. mwah π β¨
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, 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