1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_TIMEVALUE 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_TIMECONDITION (3) 9 - CURLOPT_TIMEVALUE_LARGE (3) 10Protocol: 11 - HTTP 12Added-in: 7.1 13--- 14 15# NAME 16 17CURLOPT_TIMEVALUE - time value for conditional 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE, long val); 25~~~ 26 27# DESCRIPTION 28 29Pass a long *val* as parameter. This should be the time counted as seconds 30since 1 Jan 1970, and the time is used in a condition as specified with 31CURLOPT_TIMECONDITION(3). 32 33On systems with 32-bit 'long' variables (such as Windows), this option cannot 34set dates beyond the year 2038. Consider CURLOPT_TIMEVALUE_LARGE(3) 35instead. 36 37# DEFAULT 38 390 40 41# %PROTOCOLS% 42 43# EXAMPLE 44 45~~~c 46int 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 68Returns CURLE_OK 69