13#if defined(RESTINIO_ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
51 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
59 file_path, GetLastError() )
63 return file_descriptor;
67template <
typename META >
72 std::chrono::system_clock::time_point flastmodified;
76 LARGE_INTEGER file_size;
78 if( GetFileSizeEx( fd, &file_size ) )
80 fsize =
static_cast< file_size_t >( file_size.QuadPart );
87 "unable to get file size: error code:{}" ),
93 if( GetFileTime( fd, NULL, NULL, &ftWrite ) )
98 constexpr std::uint64_t nanosec100_in_microsec = 10;
99 constexpr std::uint64_t epoch_difference_in_microsec =
100 11644473600ULL * 1000 *1000;
105 ull.LowPart = ftWrite.dwLowDateTime;
106 ull.HighPart = ftWrite.dwHighDateTime;
109 std::chrono::system_clock::time_point{
110 std::chrono::microseconds(
111 ull.QuadPart / nanosec100_in_microsec - epoch_difference_in_microsec ) };
118 "unable to get file last modification: error code:{}" ),
124 return META{ fsize, flastmodified};
#define RESTINIO_FMT_FORMAT_STRING(s)
constexpr file_descriptor_t null_file_descriptor()
Get file descriptor which stands for null.
std::uint64_t file_size_t
void close_file(file_descriptor_t fd)
Close file by its descriptor.
std::int64_t file_offset_t
std::FILE * file_descriptor_t
file_descriptor_t open_file(const char *file_path)
Open file.
META get_file_meta(file_descriptor_t fd)
Get file size.