This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Use Fuchsia-native monotonic clock for std::chrono::steady_clock
ClosedPublic

Authored by mcgrathr on Jan 4 2022, 10:26 AM.

Details

Summary

Use the zx_clock_get_monotonic system call directly rather than
going through the POSIX clock_gettime function. The libc function
is a trivial wrapper around the system call, and is not a standard C
function. Avoiding it reduces the Fuchsia libc ABI surface that
libc++ depends on.

Diff Detail

Event Timeline

mcgrathr created this revision.Jan 4 2022, 10:26 AM
mcgrathr requested review of this revision.Jan 4 2022, 10:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 4 2022, 10:26 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
phosek accepted this revision.Jan 4 2022, 10:29 AM

LGTM

libcxx/src/chrono.cpp
273–284

The rest of this file doesn't seem to be using this indentation.

mcgrathr added inline comments.Jan 4 2022, 11:07 AM
libcxx/src/chrono.cpp
273–284

AFAICT it's not consistent within the file. There are spaces after # in the some of the blocks at the top but not everywhere else.
The formatting in this change is the result of arc diff doing its idea of lint checks, which AIUI is clang-format on the lines mentioned in the diff.

Ping. This is very similar to the other change I landed recently. It needs approval from a libc++ maintainer.
Thanks.

ldionne accepted this revision.Jan 10 2022, 12:44 PM
This revision is now accepted and ready to land.Jan 10 2022, 12:44 PM