[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add host_get_time64 RPC to return the time as time_value64_t
From: |
Samuel Thibault |
Subject: |
Re: [PATCH] Add host_get_time64 RPC to return the time as time_value64_t. |
Date: |
Mon, 16 Jan 2023 23:37:47 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Flavio Cruz, le ven. 13 janv. 2023 03:27:05 -0500, a ecrit:
> #define time_value64_assert(val) \
> - assert(0 <= (val)->nanoseconds && (val)->nanoseconds < TIME_NANOS_MAX);
> + assert(0 <= (val).nanoseconds && (val).nanoseconds < TIME_NANOS_MAX);
[...]
> +#define time_value64_add_nanos(val, nanos) { \
> + time_value64_assert(*val); \
[...]
Macros such as TIMEVAL_TO_TIMESPEC etc. do always take pointers, so
better keep coherent with them.
> -record_time_stamp (time_value_t *stamp)
> +record_time_stamp(time_value_t *stamp)
> {
> - read_mapped_time(stamp);
> - time_value_add(stamp, &clock_boottime_offset);
> + time_value64_t stamp64;
> + read_mapped_time(&stamp64);
> + time_value64_add(&stamp64, clock_boottime_offset);
> + stamp->seconds = stamp64.seconds;
> + stamp->microseconds = stamp64.nanoseconds / 1000;
There are quite a few such conversions, perhaps introduce a macro to
convert between time_value_t and time_value64_t?
Samuel