std::filesystem::directory_entry::last_write_time

std::filesystem::file_time_type last_write_time() const;
std::filesystem::file_time_type last_write_time( std::error_code& ec ) const noexcept;
(C++17 起)

若最后修改时间缓存于此 directory_entry ,则返回缓存值。否则,各返回 std::filesystem::last_write_time(path())std::filesystem::last_write_time(path(), ec)

目录

参数

ec - 不抛出重载中报告错误的输出参数

返回值

被指代文件系统对象的最后修改时间

异常

不接受 std::error_code& 参数的重载在底层 OS API 错误时抛出 filesystem_error ,以第一参数 p 和作为错误码参数的 OS 错误码构造。若内存分配失败则可能抛出 std::bad_alloc 。若 OS API 调用失败,则接受 std::error_code& 参数的重载设置该参数为 OS API 错误码,而若不出现错误则执行 ec.clear()

示例

参阅

获取或设置最近一次数据修改的时间
(函数)

版本历史

  • (当前 | 先前) 2017年4月30日 (日) 20:54Fruderica讨论 | 贡献. . (852字节) (+852). . (以“{{cpp/filesystem/directory_entry/title|last_write_time}} {{cpp/filesystem/directory_entry/navbar}} {{dcl begin}} {{dcl | since=c++17 | 1= std::filesystem::file_time_...”为内容创建页面)