From 191ab4f46ebae2bcfb5039079f9cd786d84fed29 Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Tue, 15 Nov 2022 15:26:36 -0800 Subject: [PATCH] [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 --- libc/src/time/gettimeofday.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libc/src/time/gettimeofday.cpp b/libc/src/time/gettimeofday.cpp index 115a8b7869634..266ba14648a2c 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(clockid), - reinterpret_cast(&tp)); + long ret_val = __llvm_libc::syscall_impl(SYS_clock_gettime, + static_cast(CLOCK_REALTIME), + reinterpret_cast(&tp)); // A negative return value indicates an error with the magnitude of the // value being the error code. if (ret_val < 0) {