<time.h>: change the new C23 TIME_ constants.
Jens Gustedt suggested a better implementation last year on the musl
mailing list: https://www.openwall.com/lists/musl/2022/11/19/1
It means the constants are sparse, but in return it means we can add
future constants and they'll be backward compatible. (Sadly you'll need
to be on API level 35 before you can use anything but TIME_UTC.)
I doubt this will ever matter, because everyone should just stick to
clock_gettime()/clock_getres() anyway, and anyone who does have a
legitimate use for timespec_get() and timespec_getres() probably needs
to support non-Linux and so can't use any clocks that aren't in ISO C
anyway. But given that we don't _have_ to paint ourselves into a corner
here, we may as well take the opportunity to not do so.
Test: strace
Change-Id: I293d32fcbcf7f6703564dac0978ae2a10192a482
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