[libc-commits] [libc] [libc][time] Add timer_t. (PR #214776)

via libc-commits libc-commits at lists.llvm.org
Fri Aug 7 08:55:40 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: lntue

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/214776.diff


7 Files Affected:

- (modified) libc/hdr/types/CMakeLists.txt (+9) 
- (added) libc/hdr/types/timer_t.h (+22) 
- (modified) libc/include/CMakeLists.txt (+2) 
- (modified) libc/include/llvm-libc-types/CMakeLists.txt (+1) 
- (added) libc/include/llvm-libc-types/timer_t.h (+14) 
- (modified) libc/include/sys/types.yaml (+1) 
- (modified) libc/include/time.yaml (+1) 


``````````diff
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index 72b93c0e5dd0e..38e586bded61e 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -272,6 +272,15 @@ add_proxy_header_library(
     libc.include.time
 )
 
+add_proxy_header_library(
+  timer_t
+  HDRS
+    timer_t.h
+  FULL_BUILD_DEPENDS
+    libc.include.llvm-libc-types.timer_t
+    libc.include.time
+)
+
 add_proxy_header_library(
   clockid_t
   HDRS
diff --git a/libc/hdr/types/timer_t.h b/libc/hdr/types/timer_t.h
new file mode 100644
index 0000000000000..57090179ba179
--- /dev/null
+++ b/libc/hdr/types/timer_t.h
@@ -0,0 +1,22 @@
+//===-- Proxy for timer_t -------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_TYPES_TIMER_T_H
+#define LLVM_LIBC_HDR_TYPES_TIMER_T_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/timer_t.h"
+
+#else // Overlay mode
+
+#include <time.h>
+
+#endif // LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_TIMER_T_H
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index ac5d249410a17..485012a6c2aca 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -359,6 +359,7 @@ add_header_macro(
     .llvm-libc-types.clock_t
     .llvm-libc-types.errno_t
     .llvm-libc-types.time_t
+    .llvm-libc-types.timer_t
     .llvm-libc-types.struct_tm
     .llvm-libc-types.struct_timespec
     .llvm-libc-types.struct_timeval
@@ -906,6 +907,7 @@ add_header_macro(
     .llvm-libc-types.ssize_t
     .llvm-libc-types.suseconds_t
     .llvm-libc-types.time_t
+    .llvm-libc-types.timer_t
     .llvm-libc-types.u_char
     .llvm-libc-types.u_int
     .llvm-libc-types.u_int16_t
diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt
index a63c884040150..e6aa0497837b5 100644
--- a/libc/include/llvm-libc-types/CMakeLists.txt
+++ b/libc/include/llvm-libc-types/CMakeLists.txt
@@ -120,6 +120,7 @@ add_header(pthread_t HDR pthread_t.h DEPENDS .__thread_type)
 add_header(pthread_id_np_t HDR pthread_id_np_t.h DEPENDS libc.include.llvm-libc-macros.stdint_macros)
 add_header(rlim_t HDR rlim_t.h)
 add_header(time_t HDR time_t_64.h DEST_HDR time_t.h)
+add_header(timer_t HDR timer_t.h)
 add_header(sighandler_t HDR sighandler_t.h)
 add_header(stack_t HDR stack_t.h DEPENDS .size_t)
 add_header(suseconds_t HDR suseconds_t.h)
diff --git a/libc/include/llvm-libc-types/timer_t.h b/libc/include/llvm-libc-types/timer_t.h
new file mode 100644
index 0000000000000..dc58a194d4928
--- /dev/null
+++ b/libc/include/llvm-libc-types/timer_t.h
@@ -0,0 +1,14 @@
+//===-- Definition of timer_t type ----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TYPES_TIMER_T_H
+#define LLVM_LIBC_TYPES_TIMER_T_H
+
+typedef void *timer_t;
+
+#endif // LLVM_LIBC_TYPES_TIMER_T_H
diff --git a/libc/include/sys/types.yaml b/libc/include/sys/types.yaml
index dcd65c8707a90..8130e48eec261 100644
--- a/libc/include/sys/types.yaml
+++ b/libc/include/sys/types.yaml
@@ -32,6 +32,7 @@ types:
   - type_name: ssize_t
   - type_name: suseconds_t
   - type_name: time_t
+  - type_name: timer_t
   - type_name: u_char
   - type_name: u_int
   - type_name: u_int16_t
diff --git a/libc/include/time.yaml b/libc/include/time.yaml
index 2c18c5b8fc87f..a7c0cc7cc3e8e 100644
--- a/libc/include/time.yaml
+++ b/libc/include/time.yaml
@@ -13,6 +13,7 @@ types:
   - type_name: struct_timespec
   - type_name: struct_tm
   - type_name: time_t
+  - type_name: timer_t
   - type_name: clock_t
   - type_name: rsize_t
   - type_name: size_t

``````````

</details>


https://github.com/llvm/llvm-project/pull/214776


More information about the libc-commits mailing list