GNURLOPT_TIMEVALUE(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’… GNURLOPT_TIMEVALUE(3) πŸ’…

okay bestie so this is a page from the gnurl corner of the curl_easy_setopt options manual β€” yes, the whole squad of curl_easy_setopt pages, and this one is about setting a time value for conditional requests ✨


🌸 NAME 🌸

CURLOPT_TIMEVALUE β€” set the time value for your conditional request, periodt πŸŽ€


✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE, long val);

πŸ¦‹ DESCRIPTION πŸ¦‹

So you pass a long in as val. That's it, that's the vibe πŸ’œ

That number is the time counted as seconds since 1 Jan 1970 (yes, the epoch, we love a classic), and the time is gonna get used in a condition β€” the condition being whatever you specified with CURLOPT_TIMECONDITION(3). iykyk πŸ’…

⚠️ okay real talk: on systems where long is 32 bit, this option cannot set dates beyond the year 2038 😭 not me being dramatic, that's literally the limit. Consider CURLOPT_TIMEVALUE_LARGE(3) instead and slay on 🫢

πŸ“ DEFAULT πŸ“

0


🌈 PROTOCOLS 🌈

HTTP, FTP, RTSP, and FILE β€” she's versatile, she contains multitudes πŸ’–


πŸ”₯ EXAMPLE πŸ”₯

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");

  /* January 1, 2020 is 1577833200 */
  curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);

  /* If-Modified-Since the above time stamp */
  curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);

  /* Perform the request */
  curl_easy_perform(curl);
}

like look at her go 😭 the timestamp is doing the absolute most and she knows it πŸ‘‘


⭐ AVAILABILITY ⭐

Always. literally always, she's not going anywhere πŸ’€πŸ«Ά


πŸ’« RETURN VALUE πŸ’«

Returns CURLE_OK β€” the good ending, no cap 🌸


🧚 SEE ALSO 🧚


πŸŽ€ and that's the page bestie! brought to you by libcurl 7.37.0, dated 17 Jun 2014, filed under GNURLOPT_TIMEVALUE(3) β€” iconic behavior from start to finish, mwah πŸ’‹βœ¨
πŸ“¦ where this page comes from