CURLOPT_TIMEVALUE_LARGE.md (1579B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_TIMEVALUE_LARGE 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLINFO_FILETIME (3) 9 - CURLOPT_TIMECONDITION (3) 10 - CURLOPT_TIMEVALUE (3) 11 Protocol: 12 - HTTP 13 Added-in: 7.59.0 14 --- 15 16 # NAME 17 18 CURLOPT_TIMEVALUE_LARGE - time value for conditional 19 20 # SYNOPSIS 21 22 ~~~c 23 #include <curl/curl.h> 24 25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE_LARGE, 26 curl_off_t val); 27 ~~~ 28 29 # DESCRIPTION 30 31 Pass a curl_off_t *val* as parameter. This should be the time counted as 32 seconds since 1 Jan 1970, and the time is used in a condition as specified 33 with CURLOPT_TIMECONDITION(3). 34 35 The difference between this option and CURLOPT_TIMEVALUE(3) is the type of the 36 argument. On systems where 'long' is only 32 bits wide, this option has to be 37 used to set dates beyond the year 2038. 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 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 53 54 /* January 1, 2020 is 1577833200 */ 55 curl_easy_setopt(curl, CURLOPT_TIMEVALUE_LARGE, (curl_off_t)1577833200); 56 57 /* If-Modified-Since the above time stamp */ 58 curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); 59 60 /* Perform the request */ 61 curl_easy_perform(curl); 62 } 63 } 64 ~~~ 65 66 # %AVAILABILITY% 67 68 # RETURN VALUE 69 70 curl_easy_setopt(3) returns a CURLcode indicating success or error. 71 72 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 73 libcurl-errors(3).