1CURLINFO_FILETIME(3)       curl_easy_getinfo options      CURLINFO_FILETIME(3)
2
3
4

NAME

6       CURLINFO_FILETIME_T - get the remote time of the retrieved document
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode     curl_easy_getinfo(CURL    *handle,    CURLINFO_FILETIME_T,
12       curl_off_t *timep);
13

DESCRIPTION

15       Pass a pointer to a curl_off_t to receive the remote time  of  the  re‐
16       trieved  document (in number of seconds since 1 jan 1970 in the GMT/UTC
17       time zone). If you get -1, it can be because of many reasons (it  might
18       be  unknown, the server might hide it or the server doesn't support the
19       command that tells document time etc) and the time of the  document  is
20       unknown.
21
22       You must ask libcurl to collect this information before the transfer is
23       made, by using the CURLOPT_FILETIME(3) option to curl_easy_setopt(3) or
24       you will unconditionally get a -1 back.
25
26       This  option is an alternative to CURLINFO_FILETIME(3) to allow systems
27       with 32 bit long variables to extract dates outside of the 32bit  time‐
28       stamp range.
29

PROTOCOLS

31       HTTP(S), FTP(S), SFTP
32

EXAMPLE

34       curl = curl_easy_init();
35       if(curl) {
36         curl_easy_setopt(curl, CURLOPT_URL, url);
37         /* Ask for filetime */
38         curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
39         res = curl_easy_perform(curl);
40         if(CURLE_OK == res) {
41           curl_off_t filetime;
42           res = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime);
43           if((CURLE_OK == res) && (filetime >= 0)) {
44             time_t file_time = (time_t)filetime;
45             printf("filetime %s: %s", filename, ctime(&file_time));
46           }
47         }
48         /* always cleanup */
49         curl_easy_cleanup(curl);
50       }
51

AVAILABILITY

53       Added in 7.59.0
54

RETURN VALUE

56       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
57       if not.
58

SEE ALSO

60       curl_easy_getinfo(3), curl_easy_setopt(3),
61
62
63
64libcurl 7.79.1                 November 04, 2020          CURLINFO_FILETIME(3)
Impressum