1CURLOPT_FILETIME(3)        curl_easy_setopt options        CURLOPT_FILETIME(3)
2
3
4

NAME

6       CURLOPT_FILETIME - get the modification time of the remote resource
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FILETIME, long gettime);
12

DESCRIPTION

14       Pass  a  long. If it is 1, libcurl will attempt to get the modification
15       time of the remote document in this operation. This requires  that  the
16       remote server sends the time or replies to a time querying command. The
17       curl_easy_getinfo(3) function with  the  CURLINFO_FILETIME(3)  argument
18       can be used after a transfer to extract the received time (if any).
19

DEFAULT

21       0
22

PROTOCOLS

24       HTTP, FTP, SFTP, FILE
25

EXAMPLE

27       curl = curl_easy_init();
28       if(curl) {
29         curl_easy_setopt(curl, CURLOPT_URL, url);
30         /* Ask for filetime */
31         curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
32         res = curl_easy_perform(curl);
33         if(CURLE_OK == res) {
34           res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
35           if((CURLE_OK == res) && (filetime >= 0)) {
36             time_t file_time = (time_t)filetime;
37             printf("filetime %s: %s", filename, ctime(&file_time));
38           }
39         }
40         /* always cleanup */
41         curl_easy_cleanup(curl);
42       }
43

AVAILABILITY

45       Always, for SFTP since 7.49.0
46

RETURN VALUE

48       Returns CURLE_OK
49

SEE ALSO

51       curl_easy_getinfo(3),
52
53
54
55libcurl 7.82.0                 November 26, 2021           CURLOPT_FILETIME(3)
Impressum