[libc-commits] [libc] 5753be4 - [libc] Fix utimes build when full_build=OFF (#149668)

via libc-commits libc-commits at lists.llvm.org
Sat Jul 19 12:37:46 PDT 2025


Author: Mikhail R. Gadelha
Date: 2025-07-19T16:37:42-03:00
New Revision: 5753be4ea29a01a601eeee7380a2f5a284711d7a

URL: https://github.com/llvm/llvm-project/commit/5753be4ea29a01a601eeee7380a2f5a284711d7a
DIFF: https://github.com/llvm/llvm-project/commit/5753be4ea29a01a601eeee7380a2f5a284711d7a.diff

LOG: [libc] Fix utimes build when full_build=OFF (#149668)

We might pull a header from the host where tv_nsec is not a long, 
so compilation would fail with an implicit conversion error.

Added: 
    

Modified: 
    libc/src/sys/time/linux/utimes.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/sys/time/linux/utimes.cpp b/libc/src/sys/time/linux/utimes.cpp
index ed37b42aedf6c..9c00ce9909f2f 100644
--- a/libc/src/sys/time/linux/utimes.cpp
+++ b/libc/src/sys/time/linux/utimes.cpp
@@ -59,8 +59,10 @@ LLVM_LIBC_FUNCTION(int, utimes,
     ts[1].tv_sec = times[1].tv_sec;
 
     // convert u-seconds to nanoseconds
-    ts[0].tv_nsec = times[0].tv_usec * 1000;
-    ts[1].tv_nsec = times[1].tv_usec * 1000;
+    ts[0].tv_nsec =
+        static_cast<decltype(ts[0].tv_nsec)>(times[0].tv_usec * 1000);
+    ts[1].tv_nsec =
+        static_cast<decltype(ts[1].tv_nsec)>(times[1].tv_usec * 1000);
 
     ts_ptr = ts;
   }


        


More information about the libc-commits mailing list