CURLOPT_TIMEVALUE.md (1441B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_TIMEVALUE 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_TIMECONDITION (3) 9 - CURLOPT_TIMEVALUE_LARGE (3) 10 Protocol: 11 - HTTP 12 Added-in: 7.1 13 --- 14 15 # NAME 16 17 CURLOPT_TIMEVALUE - time value for conditional 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE, long val); 25 ~~~ 26 27 # DESCRIPTION 28 29 Pass a long *val* as parameter. This should be the time counted as seconds 30 since 1 Jan 1970, and the time is used in a condition as specified with 31 CURLOPT_TIMECONDITION(3). 32 33 On systems with 32-bit 'long' variables (such as Windows), this option cannot 34 set dates beyond the year 2038. Consider CURLOPT_TIMEVALUE_LARGE(3) 35 instead. 36 37 # DEFAULT 38 39 0 40 41 # %PROTOCOLS% 42 43 # EXAMPLE 44 45 ~~~c 46 int main(void) 47 { 48 CURL *curl = curl_easy_init(); 49 if(curl) { 50 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 51 52 /* January 1, 2020 is 1577833200 */ 53 curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L); 54 55 /* If-Modified-Since the above time stamp */ 56 curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); 57 58 /* Perform the request */ 59 curl_easy_perform(curl); 60 } 61 } 62 ~~~ 63 64 # %AVAILABILITY% 65 66 # RETURN VALUE 67 68 curl_easy_setopt(3) returns a CURLcode indicating success or error. 69 70 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 71 libcurl-errors(3).