[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH hurd] libshouldbeinlibc: Use 64bit mapped time values in maptime_
From: |
Zhaoming Luo |
Subject: |
[PATCH hurd] libshouldbeinlibc: Use 64bit mapped time values in maptime_read when possible |
Date: |
Sat, 3 May 2025 12:49:56 +0800 |
Use 64bit mapped time values in maptime_read when possible. The 64bit
time values in mapped time will be zero when the kernel does not support
64bit mapped time.
---
libshouldbeinlibc/maptime.h | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/libshouldbeinlibc/maptime.h b/libshouldbeinlibc/maptime.h
index 04ce0353..cf748b99 100644
--- a/libshouldbeinlibc/maptime.h
+++ b/libshouldbeinlibc/maptime.h
@@ -48,14 +48,29 @@ extern void maptime_read (volatile struct mapped_time_value
*mtime, struct timev
MAPTIME_EI void
maptime_read (volatile struct mapped_time_value *mtime, struct timeval *tv)
{
- do
+ if (mtime->time_value.seconds == 0)
{
- tv->tv_sec = mtime->seconds;
- __sync_synchronize ();
- tv->tv_usec = mtime->microseconds;
- __sync_synchronize ();
+ /* If 64 bits time is not supported in the kernel. */
+ do
+ {
+ tv->tv_sec = mtime->seconds;
+ __sync_synchronize ();
+ tv->tv_usec = mtime->microseconds;
+ __sync_synchronize ();
+ }
+ while (tv->tv_sec != mtime->check_seconds);
+ }
+ else
+ {
+ do
+ {
+ tv->tv_sec = mtime->time_value.seconds;
+ __sync_synchronize ();
+ tv->tv_usec = mtime->time_value.nanoseconds / 1000;
+ __sync_synchronize ();
+ }
+ while (tv->tv_sec != mtime->check_seconds64);
}
- while (tv->tv_sec != mtime->check_seconds);
}
#endif /* Use extern inlines. */
--
2.49.0
- [PATCH hurd] libshouldbeinlibc: Use 64bit mapped time values in maptime_read when possible,
Zhaoming Luo <=