Title
file_clock breaks ABI for C++17 implementations
Status
c++20
Section
[time.clock.file]
Submitter
Billy Robert O'Neal III

Created on 2018-07-26.00:00:00 last changed 38 months ago

Messages

Date: 2018-11-12.04:39:29

Proposed resolution:

This wording is relative to N4762.

  1. Change [time.syn], header <chrono> synopsis, as indicated:

    […]
    // [time.clock.file], classtype file_clock
    classusing file_clock = see below;
    […]
    
  2. Change [time.clock.file] as indicated:

    23.17.7.5 ClassType file_clock [time.clock.file]

  3. Change [time.clock.file.overview], class file_clock synopsis, as indicated:

    namespace std::chrono {
      using file_clock = see below;
      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
      };
    }
    

    -1- The clock 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, and noexcept(file_clock::now()) is true. [Note: The type that file_clock denotes may be in a different namespace than std::chrono, such as std::filesystem. — end note]

  4. Change [time.clock.file.members] as indicated:

    static time_point now();
    

    -1- Returns: A file_clock::time_point indicating the current time.

    -2- The type file_clock shalltype denoted by file_clock provides precisely one of the following two sets of static member functions: […]

Date: 2018-11-12.04:39:29

[ 2018-11, Adopted in San Diego ]

Date: 2018-08-23.00:00:00

[ 2018-08-23 Batavia Issues processing: Minor wording changes, and status to "Tentatively Ready". ]

Date: 2018-07-30.00:00:00

[ 2018-07-30 Priority set to 1 after reflector discussion; wording updates based on several discussion contributions. ]

Previous resolution [SUPERSEDED]:

This wording is relative to N4762.

  1. Change [time.syn], header <chrono> synopsis, as indicated:

    […]
    // [time.clock.file], classtype file_clock
    classusing file_clock = see below;
    […]
    
  2. Change [time.clock.file] as indicated:

    23.17.7.5 ClassType file_clock [time.clock.file]

  3. Change [time.clock.file.overview], class file_clock synopsis, as indicated:

    namespace std::chrono {
      using file_clock = see below;
      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
      };
    }
    

    -1- The clock file_clock is an alias for a type meeting the TrivialClock requirements ([time.clock.req]), which uses 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, and noexcept(file_clock::now()) is true. [Note: The type file_clock denotes may be in a different namespace than std::chrono, such as std::filesystem. — end note]

  4. Change [time.clock.file.members] as indicated:

    static time_point now();
    

    -1- Returns: A file_clock::time_point indicating the current time.

    -2- The class file_clock shalltype denoted by file_clock provides precisely one of the following two sets of static member functions: […]

Date: 2018-07-30.21:17:08

It was pointed out in one of Eric's changes to libc++ here that P0355 adds file_clock, which is intended to be the clock used for std::filesystem::file_time_type's clock.

Unfortunately, this is an ABI break for implementations that are already shipping C++17 filesystem that did not call their clock type std::file_clock. For example, MSVC++'s is called std::filesystem::_File_time_clock.

We can keep much the same interface of P0355 by making file_clock a typedef for an unspecified type. This technically changes the associated namespaces for expressions using that clock for the sake of ADL, but I can't imagine a user who cares, as clocks aren't generally called in ADL-able expressions, durations and time_points are.

Previous resolution [SUPERSEDED]:

This wording is relative to N4750.

  1. Change [time.syn], header <chrono> synopsis, as indicated:

    […]
    // [time.clock.file], classtype file_clock
    classusing file_clock = unspecified;
    […]
    
  2. Change [time.clock.file] as indicated:

    23.17.7.5 ClassType file_clock [time.clock.file]

  3. Change [time.clock.file.overview], class file_clock synopsis, as indicated:

    namespace std::chrono {
      using file_clock = see below;
      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
      };
    }
    

    -1- The clock file_clock is an alias for a type meeting the TrivialClock requirements ([time.clock.req]), uses a signed arithmetic type for file_clock::rep, and is used to create the time_point system used for file_time_type ([filesystems]). Its epoch is unspecified. [Note: The type file_clock denotes may be in a different namespace than std::chrono, such as std::filesystem. — end note]

  4. Change [time.clock.file.members] as indicated:

    static time_point now();
    

    -1- Returns: A file_clock::time_point indicating the current time.

    -2- The class file_clock shalltype denoted by file_clock provides precisely one of the following two sets of static member functions: […]

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2018-11-12 04:39:29adminsetmessages: + msg10204
2018-11-12 04:39:29adminsetstatus: voting -> wp
2018-10-08 05:13:59adminsetstatus: ready -> voting
2018-08-24 13:31:33adminsetmessages: + msg10134
2018-08-24 13:31:33adminsetstatus: new -> ready
2018-07-30 21:17:08adminsetmessages: + msg10051
2018-07-28 11:30:11adminsetmessages: + msg10048
2018-07-26 00:00:00admincreate