Hello, Zhaoming Luo, le dim. 23 mars 2025 09:50:33 +0800, a ecrit: > Use the host_get_time64 to replace the deprecated host_get_time for > CLOCK_REALTIME.
host_get_time64 is not always available, not with older gnumach. Please use #if machinery like above in the monotonic case. In general, please always think about backward compatibility, otherwise it brings headaches in various cases. Samuel > See > https://git.savannah.gnu.org/cgit/hurd/gnumach.git/commit/?id=569df850cd7badd1e36132ad3b44aa76a4d27c25 > > --- > sysdeps/mach/clock_gettime.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c > index 381ccb84..043a985c 100644 > --- a/sysdeps/mach/clock_gettime.c > +++ b/sysdeps/mach/clock_gettime.c > @@ -57,13 +57,13 @@ __clock_gettime (clockid_t clock_id, struct timespec *ts) > > case CLOCK_REALTIME: > { > - /* __host_get_time can only fail if passed an invalid host_t. > + /* __host_get_time64 can only fail if passed an invalid host_t. > __mach_host_self could theoretically fail (producing an > invalid host_t) due to resource exhaustion, but we assume > this will never happen. */ > - time_value_t tv; > - __host_get_time (__mach_host_self (), &tv); > - TIME_VALUE_TO_TIMESPEC (&tv, ts); > + time_value64_t tv; > + __host_get_time64 (__mach_host_self (), &tv); > + TIME_VALUE64_TO_TIMESPEC (&tv, ts); > return 0; > } > > -- > 2.47.2