[PATCH v23 03/15] windows: add os shim for localtime_r
fengchengwen
fengchengwen at huawei.com
Wed Sep 18 09:09:25 CEST 2024
On 2024/9/18 12:56, Stephen Hemminger wrote:
> Windows does not have localtime_r but it does have a similar
> function that can be used instead.
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> Acked-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
> Acked-by: Morten Brørup <mb at smartsharesystems.com>
> ---
> lib/eal/windows/include/rte_os_shim.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/lib/eal/windows/include/rte_os_shim.h b/lib/eal/windows/include/rte_os_shim.h
> index eda8113662..e9741a9df2 100644
> --- a/lib/eal/windows/include/rte_os_shim.h
> +++ b/lib/eal/windows/include/rte_os_shim.h
> @@ -110,4 +110,14 @@ rte_clock_gettime(clockid_t clock_id, struct timespec *tp)
> }
> #define clock_gettime(clock_id, tp) rte_clock_gettime(clock_id, tp)
>
> +static inline struct tm *
> +rte_localtime_r(const time_t *timer, struct tm *buf)
buf always means char *, but this function return struct tm *,
suggest:
struct tm *localtime_r(const time_t *timep, struct tm *result)
> +{
> + if (localtime_s(buf, timer) == 0)
> + return buf;
> + else
> + return NULL;
> +}
> +#define localtime_r(timer, buf) rte_localtime_r(timer, buf)
> +
> #endif /* _RTE_OS_SHIM_ */
More information about the dev
mailing list