2015-08-29 04:58:00 +08:00
|
|
|
.\" **************************************************************************
|
|
|
|
.\" * _ _ ____ _
|
|
|
|
.\" * Project ___| | | | _ \| |
|
|
|
|
.\" * / __| | | | |_) | |
|
|
|
|
.\" * | (__| |_| | _ <| |___
|
|
|
|
.\" * \___|\___/|_| \_\_____|
|
|
|
|
.\" *
|
2023-01-02 20:51:48 +08:00
|
|
|
.\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
2015-08-29 04:58:00 +08:00
|
|
|
.\" *
|
|
|
|
.\" * This software is licensed as described in the file COPYING, which
|
|
|
|
.\" * you should have received as part of this distribution. The terms
|
2020-11-04 21:02:01 +08:00
|
|
|
.\" * are also available at https://curl.se/docs/copyright.html.
|
2015-08-29 04:58:00 +08:00
|
|
|
.\" *
|
|
|
|
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
.\" * copies of the Software, and permit persons to whom the Software is
|
|
|
|
.\" * furnished to do so, under the terms of the COPYING file.
|
|
|
|
.\" *
|
|
|
|
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
.\" * KIND, either express or implied.
|
|
|
|
.\" *
|
|
|
|
.\" * SPDX-License-Identifier: curl
|
2022-05-17 17:16:50 +08:00
|
|
|
.\" *
|
2015-08-29 04:58:00 +08:00
|
|
|
.\" **************************************************************************
|
|
|
|
.\"
|
2023-04-26 14:58:35 +08:00
|
|
|
.TH CURLINFO_FILETIME 3 "28 Aug 2015" libcurl libcurl
|
2015-08-29 04:58:00 +08:00
|
|
|
.SH NAME
|
|
|
|
CURLINFO_FILETIME \- get the remote time of the retrieved document
|
|
|
|
.SH SYNOPSIS
|
2021-11-26 21:20:18 +08:00
|
|
|
.nf
|
2015-08-29 04:58:00 +08:00
|
|
|
#include <curl/curl.h>
|
|
|
|
|
|
|
|
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME, long *timep);
|
2021-11-26 21:20:18 +08:00
|
|
|
.fi
|
2015-08-29 04:58:00 +08:00
|
|
|
.SH DESCRIPTION
|
|
|
|
Pass a pointer to a long to receive the remote time of the retrieved document
|
2022-09-21 05:30:19 +08:00
|
|
|
in number of seconds since January 1 1970 in the GMT/UTC time zone. If you get
|
2015-08-29 04:58:00 +08:00
|
|
|
-1, it can be because of many reasons (it might be unknown, the server might
|
2021-10-31 23:34:44 +08:00
|
|
|
hide it or the server does not support the command that tells document time
|
2015-08-29 04:58:00 +08:00
|
|
|
etc) and the time of the document is unknown.
|
|
|
|
|
2018-01-26 06:05:24 +08:00
|
|
|
You must tell libcurl to collect this information before the transfer is made,
|
|
|
|
by using the \fICURLOPT_FILETIME(3)\fP option to \fIcurl_easy_setopt(3)\fP or
|
2023-08-22 23:40:39 +08:00
|
|
|
you this unconditionally gets a -1 back.
|
2018-01-26 06:05:24 +08:00
|
|
|
|
|
|
|
Consider using \fICURLINFO_FILETIME_T(3)\fP to be able to extract dates beyond
|
2023-08-22 23:40:39 +08:00
|
|
|
the year 2038 on systems using 32 bit longs (Windows).
|
2015-08-29 04:58:00 +08:00
|
|
|
.SH PROTOCOLS
|
2016-02-25 09:10:24 +08:00
|
|
|
HTTP(S), FTP(S), SFTP
|
2015-08-29 04:58:00 +08:00
|
|
|
.SH EXAMPLE
|
2017-04-03 06:00:43 +08:00
|
|
|
.nf
|
|
|
|
curl = curl_easy_init();
|
|
|
|
if(curl) {
|
|
|
|
curl_easy_setopt(curl, CURLOPT_URL, url);
|
|
|
|
/* Ask for filetime */
|
|
|
|
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
|
|
|
|
res = curl_easy_perform(curl);
|
|
|
|
if(CURLE_OK == res) {
|
|
|
|
res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
|
|
|
|
if((CURLE_OK == res) && (filetime >= 0)) {
|
|
|
|
time_t file_time = (time_t)filetime;
|
|
|
|
printf("filetime %s: %s", filename, ctime(&file_time));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* always cleanup */
|
|
|
|
curl_easy_cleanup(curl);
|
|
|
|
}
|
|
|
|
.fi
|
2015-08-29 04:58:00 +08:00
|
|
|
.SH AVAILABILITY
|
|
|
|
Added in 7.5
|
|
|
|
.SH RETURN VALUE
|
|
|
|
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
|
|
|
|
.SH "SEE ALSO"
|
2023-09-27 05:25:11 +08:00
|
|
|
.BR curl_easy_getinfo (3),
|
|
|
|
.BR curl_easy_setopt (3),
|
|
|
|
.BR CURLOPT_FILETIME (3)
|