[time.clock.file] (original) (raw)
30.7.6.1 Overview [time.clock.file.overview]
namespace std::chrono { using file_clock = see below;}
file_clock is an alias for a type meeting the Cpp17TrivialClock requirements ([time.clock.req]), and using a signed arithmetic type for file_clock::rep.
file_clock is used to create the time_point system used for file_time_type ([filesystems]).
Its epoch is unspecified, andnoexcept(file_clock::now()) is true.
[Note 1:
The type that file_clock denotes can be in a different namespace than std::chrono, such as std::filesystem.
— _end note_]
30.7.6.2 Member functions [time.clock.file.members]
The type denoted by file_clock provides precisely one of the following two sets of static member functions:template<class Duration> static sys_time<_see below_> to_sys(const file_time<Duration>&);template<class Duration> static file_time<_see below_> from_sys(const sys_time<Duration>&);or:template<class Duration> static utc_time<_see below_> to_utc(const file_time<Duration>&);template<class Duration> static file_time<_see below_> from_utc(const utc_time<Duration>&);
These member functions shall provide time_point conversions consistent with those specified byutc_clock, tai_clock, and gps_clock.
The Duration of the resultant time_pointis computed from the Duration of the input time_point.
30.7.6.3 Non-member functions [time.clock.file.nonmembers]
template<class charT, class traits, class Duration> basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const file_time<Duration>& t);
Effects: Equivalent to:return os << format(os.getloc(), _STATICALLY-WIDEN_<charT>("{:L%F %T}"), t);
template<class charT, class traits, class Duration, class Alloc = allocator<charT>> basic_istream<charT, traits>& from_stream(basic_istream<charT, traits>& is, const charT* fmt, file_time<Duration>& tp, basic_string<charT, traits, Alloc>* abbrev = nullptr, minutes* offset = nullptr);
Effects: Attempts to parse the input stream isinto the file_time tp using the format flags given in the NTCTS fmtas specified in [time.parse].
If the parse fails to decode a valid date,is.setstate(ios_base::failbit) is called andtp is not modified.
If %Z is used and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null.
If %z (or a modified variant) is used and successfully parsed, that value will be assigned to *offset if offset is non-null.
Additionally, the parsed offset will be subtracted from the successfully parsed timestamp prior to assigning that difference to tp.