summaryrefslogtreecommitdiff
path: root/libc/spec
diff options
context:
space:
mode:
authorSiva Chandra Reddy <sivachandra@google.com>2022-10-25 06:45:45 +0000
committerSiva Chandra Reddy <sivachandra@google.com>2022-10-25 18:06:05 +0000
commit22ea0e5d9b2eb388cb235f798aacd2170f77b6e1 (patch)
treefa6dcc7fe2526371f53e1acf7bbf18281a7d44db /libc/spec
parent20204db50389d9c2b7796722d69e9c94a6a37be5 (diff)
downloadllvm-22ea0e5d9b2eb388cb235f798aacd2170f77b6e1.tar.gz
[libc] Add Linux implementations of time and clock functions.
Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D136666
Diffstat (limited to 'libc/spec')
-rw-r--r--libc/spec/stdc.td16
1 files changed, 14 insertions, 2 deletions
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 3981d0d355f9..bc3778053ae2 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -3,6 +3,7 @@ def StdC : StandardSpec<"stdc"> {
NamedType StructTmType = NamedType<"struct tm">;
PtrType StructTmPtr = PtrType<StructTmType>;
PtrType TimeTTypePtr = PtrType<TimeTType>;
+ NamedType ClockT = NamedType<"clock_t">;
NamedType DivTType = NamedType<"div_t">;
NamedType LDivTType = NamedType<"ldiv_t">;
@@ -917,8 +918,9 @@ def StdC : StandardSpec<"stdc"> {
"time.h",
[], // Macros
[ // Types
- StructTmType,
- TimeTType,
+ ClockT,
+ StructTmType,
+ TimeTType,
],
[], // Enumerations
[
@@ -936,6 +938,11 @@ def StdC : StandardSpec<"stdc"> {
]
>,
FunctionSpec<
+ "clock",
+ RetValSpec<ClockT>,
+ [ArgSpec<VoidType>]
+ >,
+ FunctionSpec<
"difftime",
RetValSpec<DoubleType>,
[
@@ -961,6 +968,11 @@ def StdC : StandardSpec<"stdc"> {
RetValSpec<TimeTType>,
[ArgSpec<StructTmPtr>]
>,
+ FunctionSpec<
+ "time",
+ RetValSpec<TimeTType>,
+ [ArgSpec<TimeTTypePtr>]
+ >,
]
>;