diff options
author | Raman Tenneti <rtenneti@google.com> | 2022-11-15 14:14:20 -0800 |
---|---|---|
committer | Raman Tenneti <rtenneti@google.com> | 2022-11-15 15:06:35 -0800 |
commit | dbd31935ed0384b5d72dd4fc5f0309853b2da844 (patch) | |
tree | 702c59bf32aa842eb243a4c7465044e173be3613 /libc/spec | |
parent | dd8fd6437e73a91ca6d0d7ccd0beac36066eb14e (diff) | |
download | llvm-dbd31935ed0384b5d72dd4fc5f0309853b2da844.tar.gz |
[libc] cleanup changes to gettimeofday.
+ Deleted duplicate definitions of StructTimeVal and StructTimeValPtr.
+ Caled syscall clock_gettime to get timespec data.
+ Added tests to test for sleeping 200 and 1000 microseconds.
+ Fixed comments from https://reviews.llvm.org/D137881
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D138064
Diffstat (limited to 'libc/spec')
-rw-r--r-- | libc/spec/posix.td | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libc/spec/posix.td b/libc/spec/posix.td index dd1be611bdd9..43cc031953b6 100644 --- a/libc/spec/posix.td +++ b/libc/spec/posix.td @@ -45,9 +45,6 @@ def ConstStructDirentPtrPtr : ConstType<StructDirentPtrPtr>; def StructTimeSpec : NamedType<"struct timespec">; def StructTimeSpecPtr : PtrType<StructTimeSpec>; -def StructTimeVal : NamedType<"struct timeval">; -def StructTimeValPtr : PtrType<StructTimeVal>; - def ExecArgvT : NamedType<"__exec_argv_t">; def ExecEnvpT : NamedType<"__exec_envp_t">; @@ -733,7 +730,7 @@ def POSIX : StandardSpec<"POSIX"> { UidT, GidT, StructTimeSpec, - StructTimeVal, + StructTimevalType, BlkSizeT, BlkCntT, OffTType, @@ -1077,7 +1074,7 @@ def POSIX : StandardSpec<"POSIX"> { HeaderSpec Time = HeaderSpec< "time.h", [], // Macros - [ClockIdT, StructTimeSpec, StructTimeVal], // Types + [ClockIdT, StructTimeSpec, StructTimevalType], // Types [], // Enumerations [ FunctionSpec< @@ -1088,7 +1085,7 @@ def POSIX : StandardSpec<"POSIX"> { FunctionSpec< "gettimeofday", RetValSpec<IntType>, - [ArgSpec<StructTimeValPtr>, ArgSpec<VoidPtr>] + [ArgSpec<StructTimevalPtr>, ArgSpec<VoidPtr>] >, FunctionSpec< "nanosleep", |