Merge "<time.h>: change the new C23 TIME_ constants."
diff --git a/libc/bionic/time.cpp b/libc/bionic/time.cpp
index 3a41027..800395e 100644
--- a/libc/bionic/time.cpp
+++ b/libc/bionic/time.cpp
@@ -28,27 +28,10 @@
 
 #include <time.h>
 
-static clockid_t __base_to_clock(int base) {
-  switch (base) {
-    case TIME_UTC:
-      return CLOCK_REALTIME;
-    case TIME_MONOTONIC:
-      return CLOCK_MONOTONIC;
-    case TIME_ACTIVE:
-      return CLOCK_PROCESS_CPUTIME_ID;
-    case TIME_THREAD_ACTIVE:
-      return CLOCK_THREAD_CPUTIME_ID;
-    default:
-      return -1;
-  }
-}
-
 int timespec_get(timespec* ts, int base) {
-  clockid_t clock = __base_to_clock(base);
-  return (clock != -1 && clock_gettime(clock, ts) != -1) ? base : 0;
+  return (clock_gettime(base - 1, ts) != -1) ? base : 0;
 }
 
 int timespec_getres(timespec* ts, int base) {
-  clockid_t clock = __base_to_clock(base);
-  return (clock != -1 && clock_getres(clock, ts) != -1) ? base : 0;
+  return (clock_getres(base - 1, ts) != -1) ? base : 0;
 }
diff --git a/libc/include/time.h b/libc/include/time.h
index 2d2de9f..1c3ae4b 100644
--- a/libc/include/time.h
+++ b/libc/include/time.h
@@ -109,28 +109,28 @@
  *
  * Available since API level 29.
  */
-#define TIME_UTC 1
+#define TIME_UTC (CLOCK_REALTIME+1)
 
 /**
  * The timebase for timespec_get() and timespec_getres() corresponding to CLOCK_MONOTONIC.
  *
  * Available since API level 35.
  */
-#define TIME_MONOTONIC 2
+#define TIME_MONOTONIC (CLOCK_MONOTONIC+1)
 
 /**
  * The timebase for timespec_get() and timespec_getres() corresponding to CLOCK_PROCESS_CPUTIME_ID.
  *
  * Available since API level 35.
  */
-#define TIME_ACTIVE 3
+#define TIME_ACTIVE (CLOCK_PROCESS_CPUTIME_ID+1)
 
 /**
  * The timebase for timespec_get() and timespec_getres() corresponding to CLOCK_THREAD_CPUTIME_ID.
  *
  * Available since API level 35.
  */
-#define TIME_THREAD_ACTIVE 4
+#define TIME_THREAD_ACTIVE (CLOCK_THREAD_CPUTIME_ID+1)
 
 /**
  * timespec_get(3) is equivalent to clock_gettime() for the clock corresponding to the given base.
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 483315d..d16600c 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -1281,7 +1281,7 @@
 TEST(time, timespec_get_invalid) {
 #if __BIONIC__
   timespec ts = {};
-  ASSERT_EQ(0, timespec_get(&ts, -1));
+  ASSERT_EQ(0, timespec_get(&ts, 123));
 #else
   GTEST_SKIP() << "glibc doesn't have timespec_get until 2.21";
 #endif