Add C11 timespec_get.
Bug: https://github.com/android-ndk/ndk/issues/744
Test: ran tests
Change-Id: Iad9514946e06d55b6a3aa0f945d9a63bff900881
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 3196f34..216f846 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -922,3 +922,13 @@
struct tm tm;
ASSERT_EQ(nullptr, strptime("x", "%s", &tm));
}
+
+TEST(time, timespec_get) {
+#if __BIONIC__
+ timespec ts = {};
+ ASSERT_EQ(0, timespec_get(&ts, 123));
+ ASSERT_EQ(TIME_UTC, timespec_get(&ts, TIME_UTC));
+#else
+ GTEST_LOG_(INFO) << "glibc doesn't have timespec_get until 2.21\n";
+#endif
+}