[libc-commits] [PATCH] D138070: [libc] [Obvious] Cleanup.

Raman Tenneti via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Nov 15 15:28:02 PST 2022


rtenneti created this revision.
rtenneti added a reviewer: sivachandra.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
rtenneti requested review of this revision.

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

  to the syscall.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138070

Files:
  libc/src/time/gettimeofday.cpp


Index: libc/src/time/gettimeofday.cpp
===================================================================
--- libc/src/time/gettimeofday.cpp
+++ libc/src/time/gettimeofday.cpp
@@ -20,11 +20,10 @@
                    (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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138070.475605.patch
Type: text/x-patch
Size: 879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221115/6235a87d/attachment-0001.bin>


More information about the libc-commits mailing list