25 Time library [time]

25.7 Clocks [time.clock]

25.7.5 Class file_­clock [time.clock.file]

25.7.5.1 Overview [time.clock.file.overview]

namespace std::chrono {
  class file_clock {
  public:
    using rep                       = a signed arithmetic type;
    using period                    = ratio<unspecified, unspecified>;
    using duration                  = chrono::duration<rep, period>;
    using time_point                = chrono::time_point<file_clock>;
    static constexpr bool is_steady = unspecified;

    static time_point now() noexcept;

    // Conversion functions, see below
  };
}
The clock file_­clock is used to create the time_­point system used for file_­time_­type ([filesystems]).
Its epoch is unspecified.

25.7.5.2 Member functions [time.clock.file.members]

static time_point now();
Returns: A file_­clock​::​time_­point indicating the current time.
The class file_­clock shall provide 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 by utc_­clock, tai_­clock, and gps_­clock.
The Duration of the resultant time_­point is computed from the Duration of the input time_­point.

25.7.5.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: Calls to_­stream(os, fmt, t), where fmt is a string containing "%F %T" widened to charT.
Returns: os.
template<class charT, class traits, class Duration> basic_ostream<charT, traits>& to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const file_time<Duration>& tp);
Effects: Streams tp into os using the format specified by the NTCTS fmt.
fmt encoding follows the rules specified in [time.format].
If %Z is used, it will be replaced with "UTC" widened to charT.
If %z is used (or a modified variant of %z), an offset of 0min will be formatted.
The date and time formatted shall be equivalent to that formatted by a sys_­time initialized with clock_­cast<system_­clock>(tp), or by a utc_­time initialized with clock_­cast<utc_­clock>(tp).
Returns: os.
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 is into the file_­time tp using the format flags given in the NTCTS fmt as specified in [time.parse].
If the parse fails to decode a valid date, is.setstate(ios_­base​::​failbit) shall be called and tp shall not be 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.
Returns: is.