Page MenuHomePhabricator

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

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


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?


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

mclow and I discussed this offline, and max= is not going to work: 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: 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

Also... ping?

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


ping x2

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

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

14 ↗(On Diff #12840)

I'd use UNSUPPORTED instead.

danalbert added inline comments.Aug 29 2014, 9:46 AM

As mentioned on, _LIBCPP_HAS_NO_MONOTONIC_CLOCK will more closely match the other configs.

jroelofs added inline comments.Aug 29 2014, 9:49 AM

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.

14 ↗(On Diff #12840)


mclow.lists added inline comments.Aug 29 2014, 10:20 AM

I concur - no need for a warning.

danalbert added inline comments.Aug 29 2014, 10:53 AM

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.


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