CURLINFO_FILETIME_T.3 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLINFO_FILETIME 3 "25 Jan 2018" "libcurl 7.59.0" "curl_easy_getinfo options"
  26. .SH NAME
  27. CURLINFO_FILETIME_T \- get the remote time of the retrieved document
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME_T,
  32. curl_off_t *timep);
  33. .fi
  34. .SH DESCRIPTION
  35. Pass a pointer to a curl_off_t to receive the remote time of the retrieved
  36. document in number of seconds since January 1 1970 in the GMT/UTC time
  37. zone. If you get -1, it can be because of many reasons (it might be unknown,
  38. the server might hide it or the server does not support the command that tells
  39. document time etc) and the time of the document is unknown.
  40. You must ask libcurl to collect this information before the transfer is made,
  41. by using the \fICURLOPT_FILETIME(3)\fP option to \fIcurl_easy_setopt(3)\fP or
  42. you will unconditionally get a -1 back.
  43. This option is an alternative to \fICURLINFO_FILETIME(3)\fP to allow systems
  44. with 32 bit long variables to extract dates outside of the 32bit timestamp
  45. range.
  46. .SH PROTOCOLS
  47. HTTP(S), FTP(S), SFTP
  48. .SH EXAMPLE
  49. .nf
  50. curl = curl_easy_init();
  51. if(curl) {
  52. curl_easy_setopt(curl, CURLOPT_URL, url);
  53. /* Ask for filetime */
  54. curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
  55. res = curl_easy_perform(curl);
  56. if(CURLE_OK == res) {
  57. curl_off_t filetime;
  58. res = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime);
  59. if((CURLE_OK == res) && (filetime >= 0)) {
  60. time_t file_time = (time_t)filetime;
  61. printf("filetime %s: %s", filename, ctime(&file_time));
  62. }
  63. }
  64. /* always cleanup */
  65. curl_easy_cleanup(curl);
  66. }
  67. .fi
  68. .SH AVAILABILITY
  69. Added in 7.59.0
  70. .SH RETURN VALUE
  71. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  72. .SH "SEE ALSO"
  73. .BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), "