This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.

1410. Add a feature-detect macro for monotonic_clock

Section: 99 [time.clock.monotonic] Status: Resolved Submitter: BSI Opened: 2010-08-25 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [time.clock.monotonic].

View all issues with Resolved status.

Duplicate of: 1411

Discussion:

Addresses GB-107, DE-20

4.1 [intro.compliance] p.9 states that which conditionally supported constructs are available should be provided in the documentation for the implementation. This doesn't help programmers trying to write portable code, as they must then rely on implementation-specific means to determine the availability of such constructs. In particular, the presence or absence of std::chrono::monotonic_clock may require different code paths to be selected. This is the only conditionally-supported library facility, and differs from the conditionally-supported language facilities in that it has standard-defined semantics rather than implementation-defined semantics.

[ Resolution proposed in ballot comment: ]

Provide feature test macro for determining the presence of std::chrono::monotonic_clock. Add _STDCPP_HAS_MONOTONIC_CLOCK to the <chrono> header, which is defined if monotonic_clock is present, and not defined if it is not present.

[ 2010-11-01 Daniel comments: ]

Paper n3128 addresses this issue by replacing monotonic_clock with steady_clock, which is not conditionally supported, so there is no need to detect it.

Proposed resolution:

This is resolved by n3191.