[libc-commits] [libc] 191ab4f - [libc] [Obvious] Cleanup.

Raman Tenneti via libc-commits libc-commits at lists.llvm.org
Tue Nov 15 15:30:19 PST 2022


Author: Raman Tenneti
Date: 2022-11-15T15:30:15-08:00
New Revision: 191ab4f46ebae2bcfb5039079f9cd786d84fed29

URL: https://github.com/llvm/llvm-project/commit/191ab4f46ebae2bcfb5039079f9cd786d84fed29
DIFF: https://github.com/llvm/llvm-project/commit/191ab4f46ebae2bcfb5039079f9cd786d84fed29.diff

LOG: [libc] [Obvious] Cleanup.

+ Avoid the `clockid` var and just passed `long(CLOCK_REALTIME)`
  to the syscall.

Reviewed By: rtenneti

Differential Revision: https://reviews.llvm.org/D138070

Added: 
    

Modified: 
    libc/src/time/gettimeofday.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/time/gettimeofday.cpp b/libc/src/time/gettimeofday.cpp
index 115a8b786963..266ba14648a2 100644
--- a/libc/src/time/gettimeofday.cpp
+++ b/libc/src/time/gettimeofday.cpp
@@ -20,11 +20,10 @@ LLVM_LIBC_FUNCTION(int, gettimeofday,
                    (struct timeval * tv, [[maybe_unused]] void *unused)) {
   if (tv == nullptr)
     return 0;
-  clockid_t clockid = CLOCK_REALTIME;
   struct timespec tp;
-  long ret_val =
-      __llvm_libc::syscall_impl(SYS_clock_gettime, static_cast<long>(clockid),
-                                reinterpret_cast<long>(&tp));
+  long ret_val = __llvm_libc::syscall_impl(SYS_clock_gettime,
+                                           static_cast<long>(CLOCK_REALTIME),
+                                           reinterpret_cast<long>(&tp));
   // A negative return value indicates an error with the magnitude of the
   // value being the error code.
   if (ret_val < 0) {


        


More information about the libc-commits mailing list