This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Partially address a FIXME in steady_clock::now()
ClosedPublic

Authored by jroelofs on Jun 6 2014, 10:07 AM.

Details

Diff Detail

Event Timeline

jroelofs updated this revision to Diff 10182.Jun 6 2014, 10:07 AM
jroelofs retitled this revision from to [libcxx] Partially address a FIXME in steady_clock::now().
jroelofs updated this object.
jroelofs edited the test plan for this revision. (Show Details)
jroelofs added a reviewer: mclow.lists.
jroelofs added a subscriber: Unknown Object (MLST).
mclow.lists edited edge metadata.Jul 15 2014, 10:02 PM

On a system w/o _POSIX_MONOTONIC_CLOCK, this will change from "libc++ will not build" to "it will build a non-conforming library"

That doesn't seem like an improvement to me.

Is it possible to build a monotonic clock out of a non-monotonic clock in
software only?

I could force it to be monotonic with some static storage and a max=, but would
that be correct?

Jon

jroelofs abandoned this revision.Jul 24 2014, 10:47 AM

mclow and I discussed this offline, and max= is not going to work:

20.12.7.2/1: Objects of class steady_clock represent clocks for which values of time_point never decrease as physical time advances and for which values of time_point advance at a steady rate relative to real time.

I'll look into what breaks if steady_clock isn't provided on systems without _POSIX_MONOTONIC_CLOCK, and go from there.

jroelofs reclaimed this revision.Aug 13 2014, 7:42 AM
jroelofs updated this revision to Diff 12449.Aug 13 2014, 7:47 AM
jroelofs edited edge metadata.

On systems without a monotonic clock, it's probably better to not have steady_clock than to have a non-conforming one.

Since steady_clock is used for timed mutexes and such, something like: http://reviews.llvm.org/D3969 is probably necessary to actually build libc++ without a a monotonic clock. I'll be picking that patch up for upstreaming again here shortly.

Vaguely depends on http://reviews.llvm.org/D3969

Also... ping?

jroelofs updated this revision to Diff 12840.Aug 22 2014, 6:21 AM

Add XFAILs

ping x2

libcxx/test/lit.site.cfg
11 ↗(On Diff #12840)

FYI, I don't intend for this to go upstream... this is just here as an example usage.

danalbert added inline comments.Aug 29 2014, 9:43 AM
include/chrono
943

Should there be a warning that the system won't use steady_clock?

libcxx/test/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
14 ↗(On Diff #12840)

I'd use UNSUPPORTED instead.

danalbert added inline comments.Aug 29 2014, 9:46 AM
include/__config
644

As mentioned on http://reviews.llvm.org/D3969, _LIBCPP_HAS_NO_MONOTONIC_CLOCK will more closely match the other configs.

jroelofs added inline comments.Aug 29 2014, 9:49 AM
include/chrono
943

Implementing high_resolution_clock via a typedef to system_clock is explicitly allowed by the standard. I don't see a reason for a warning here.

libcxx/test/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
14 ↗(On Diff #12840)

Ok

mclow.lists added inline comments.Aug 29 2014, 10:20 AM
include/chrono
944

I concur - no need for a warning.

danalbert added inline comments.Aug 29 2014, 10:53 AM
include/chrono
943

Ah, alright. Fine by me.

jroelofs updated this revision to Diff 13183.Sep 2 2014, 2:15 PM

Rename the flag to _LIBCPP_HAS_NO_MONOTONIC_CLOCK, and change the XFAILs to UNSUPPORTEDs.

danalbert accepted this revision.Sep 2 2014, 2:22 PM
danalbert edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Sep 2 2014, 2:22 PM
jroelofs closed this revision.Sep 2 2014, 2:24 PM

r216949