bionic: fix pthread_mutex_timedlock for PI mutexes
FUTEX_LOCK_PI uses CLOCK_REALTIME so adjust clock timebase
accordingly.
FUTEX_WAIT_BITSET, FUTEX_WAIT_REQUEUE_PI, FUTEX_LOCK_PI2
are updated to check the presence of FUTEX_CLOCK_REALTIME flag.
Test: atest bionic-unit-tests
Bug: 312787238
Bug: 315897315
Change-Id: I2d93286cf22d3b3d9f3757d49b46f7ee9ea5490c
diff --git a/libc/private/bionic_constants.h b/libc/private/bionic_constants.h
index 05914f4..6274fe2 100644
--- a/libc/private/bionic_constants.h
+++ b/libc/private/bionic_constants.h
@@ -16,7 +16,7 @@
#pragma once
-#define NS_PER_S 1000000000
+#define NS_PER_S 1'000'000'000LL
// Size of the shadow call stack. This can be small because these stacks only
// contain return addresses. This must be a power of 2 so the mask trick works.
diff --git a/libc/private/bionic_time_conversions.h b/libc/private/bionic_time_conversions.h
index fb049f2..c6b3c78 100644
--- a/libc/private/bionic_time_conversions.h
+++ b/libc/private/bionic_time_conversions.h
@@ -45,6 +45,9 @@
__LIBC_HIDDEN__ void monotonic_time_from_realtime_time(timespec& monotonic_time,
const timespec& realtime_time);
+__LIBC_HIDDEN__ void realtime_time_from_monotonic_time(timespec& realtime_time,
+ const timespec& monotonic_time);
+
__END_DECLS
static inline int check_timespec(const timespec* ts, bool null_allowed) {