CURLOPT_TIMECONDITION.3 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. .\" generated by cd2nroff 0.1 from CURLOPT_TIMECONDITION.md
  2. .TH CURLOPT_TIMECONDITION 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_TIMECONDITION \- select condition for a time request
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMECONDITION, long cond);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long as parameter. This defines how the \fICURLOPT_TIMEVALUE(3)\fP time
  12. value is treated. You can set this parameter to \fICURL_TIMECOND_IFMODSINCE\fP
  13. or \fICURL_TIMECOND_IFUNMODSINCE\fP.
  14. The last modification time of a file is not always known and in such instances
  15. this feature has no effect even if the given time condition would not have
  16. been met. \fIcurl_easy_getinfo(3)\fP with the \fICURLINFO_CONDITION_UNMET\fP
  17. option can be used after a transfer to learn if a zero\-byte successful
  18. \&"transfer" was due to this condition not matching.
  19. .SH DEFAULT
  20. CURL_TIMECOND_NONE (0)
  21. .SH PROTOCOLS
  22. This functionality affects http only
  23. .SH EXAMPLE
  24. .nf
  25. int main(void)
  26. {
  27. CURL *curl = curl_easy_init();
  28. if(curl) {
  29. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  30. /* January 1, 2020 is 1577833200 */
  31. curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
  32. /* If-Modified-Since the above time stamp */
  33. curl_easy_setopt(curl, CURLOPT_TIMECONDITION,
  34. (long)CURL_TIMECOND_IFMODSINCE);
  35. /* Perform the request */
  36. curl_easy_perform(curl);
  37. }
  38. }
  39. .fi
  40. .SH AVAILABILITY
  41. Added in curl 7.1
  42. .SH RETURN VALUE
  43. Returns CURLE_OK
  44. .SH SEE ALSO
  45. .BR CURLINFO_FILETIME (3),
  46. .BR CURLOPT_TIMEVALUE (3)