Files
cppdraft_translate/cppdraft/fs/op/last/write/time.md
2025-10-25 03:02:53 +03:00

62 lines
2.2 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[fs.op.last.write.time]
# 31 Input/output library [[input.output]](./#input.output)
## 31.12 File systems [[filesystems]](filesystems#fs.op.last.write.time)
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.last.write.time)
#### 31.12.13.26 Last write time [fs.op.last.write.time]
[🔗](#lib:last_write_time)
`file_time_type filesystem::last_write_time(const path& p);
file_time_type filesystem::last_write_time(const path& p, error_code& ec) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18247)
*Returns*: The time of last data modification of p,
determined as if by the value of the POSIX stat class member st_mtime obtained as if by POSIX stat[.](#1.sentence-1)
The signature with argument ec returns file_time_type::min() if an error occurs[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18255)
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5Error reporting")[.](#2.sentence-1)
[🔗](#lib:last_write_time_)
`void filesystem::last_write_time(const path& p, file_time_type new_time);
void filesystem::last_write_time(const path& p, file_time_type new_time,
error_code& ec) noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18268)
*Effects*: Sets the time of last data modification of the file
resolved to by p to new_time, as if by POSIX [futimens](http://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html)[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18273)
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5Error reporting")[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18277)
[*Note [1](#note-1)*:
A postcondition of last_write_time(p) == new_time is not specified
because it does not necessarily hold for file systems with coarse time granularity[.](#5.sentence-1)
— *end note*]