Skip to content

Commit

Permalink
[libc] [Obvious] Cleanup.
Browse files Browse the repository at this point in the history
+ Avoid the `clockid` var and just passed `long(CLOCK_REALTIME)`
  to the syscall.

Reviewed By: rtenneti

Differential Revision: https://reviews.llvm.org/D138070
  • Loading branch information
rtenneti-google committed Nov 15, 2022
1 parent 4bc86ae commit 191ab4f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions libc/src/time/gettimeofday.cpp
Expand Up @@ -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) {
Expand Down

0 comments on commit 191ab4f

Please sign in to comment.