quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_FILETIME.md (1683B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_FILETIME
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLINFO_FILETIME (3)
      9   - curl_easy_getinfo (3)
     10 Protocol:
     11   - HTTP
     12   - FTP
     13   - SFTP
     14   - FILE
     15   - SMB
     16 Added-in: 7.5
     17 ---
     18 
     19 # NAME
     20 
     21 CURLOPT_FILETIME - get the modification time of the remote resource
     22 
     23 # SYNOPSIS
     24 
     25 ~~~c
     26 #include <curl/curl.h>
     27 
     28 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FILETIME, long gettime);
     29 ~~~
     30 
     31 # DESCRIPTION
     32 
     33 Pass a long. If it is 1, libcurl attempts to get the modification time of the
     34 remote document in this operation. This requires that the remote server sends
     35 the time or replies to a time querying command. The curl_easy_getinfo(3)
     36 function with the CURLINFO_FILETIME(3) argument can be used after a
     37 transfer to extract the received time (if any).
     38 
     39 # DEFAULT
     40 
     41 0
     42 
     43 # %PROTOCOLS%
     44 
     45 # EXAMPLE
     46 
     47 ~~~c
     48 int main(void)
     49 {
     50   CURL *curl = curl_easy_init();
     51   if(curl) {
     52     CURLcode res;
     53     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/path.html");
     54     /* Ask for filetime */
     55     curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
     56     res = curl_easy_perform(curl);
     57     if(CURLE_OK == res) {
     58       long filetime;
     59       res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
     60       if((CURLE_OK == res) && (filetime >= 0)) {
     61         time_t file_time = (time_t)filetime;
     62         printf("filetime: %s", ctime(&file_time));
     63       }
     64     }
     65     /* always cleanup */
     66     curl_easy_cleanup(curl);
     67   }
     68 }
     69 ~~~
     70 
     71 # %AVAILABILITY%
     72 
     73 # RETURN VALUE
     74 
     75 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     76 
     77 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     78 libcurl-errors(3).