This is an archive of the discontinued LLVM Phabricator instance.

[libc] add clock_gettime
ClosedPublic

Authored by michaelrj on Sep 27 2022, 3:53 PM.

Details

Summary

Add the clock_gettime syscall wrapper and tests.

Diff Detail

Event Timeline

michaelrj created this revision.Sep 27 2022, 3:53 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 27 2022, 3:53 PM
michaelrj requested review of this revision.Sep 27 2022, 3:53 PM
sivachandra added inline comments.Sep 28 2022, 12:12 AM
libc/include/llvm-libc-types/time_t.h
14

A new type should be defined in its own header file - we follow the rule of exactly one type defined in a complete header file. By complete header file, we mean that including it will pull dependent macros and types as well and make the type definition complete (the type itself can be of an incomplete type, for example FILE.)

move clockid_t into separate header

michaelrj marked an inline comment as done.Sep 28 2022, 10:29 AM
sivachandra accepted this revision.Sep 28 2022, 11:33 AM
sivachandra added inline comments.
libc/src/time/clock_gettime.cpp
27

What is this for?

This revision is now accepted and ready to land.Sep 28 2022, 11:33 AM
michaelrj marked an inline comment as done.Sep 29 2022, 10:18 AM
michaelrj added inline comments.
libc/src/time/clock_gettime.cpp
27

testing, I forgot to delete it.

This revision was automatically updated to reflect the committed changes.
michaelrj marked an inline comment as done.