From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 02495459CB; Thu, 19 Sep 2024 03:07:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BA08142E5B; Thu, 19 Sep 2024 03:07:32 +0200 (CEST) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id 6D05F40156 for ; Thu, 19 Sep 2024 03:07:30 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4X8HRC5Q7hz1S8sC; Thu, 19 Sep 2024 09:06:47 +0800 (CST) Received: from dggpeml500024.china.huawei.com (unknown [7.185.36.10]) by mail.maildlp.com (Postfix) with ESMTPS id 73EC51A016C; Thu, 19 Sep 2024 09:07:27 +0800 (CST) Received: from [10.67.121.161] (10.67.121.161) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 19 Sep 2024 09:07:27 +0800 Message-ID: <315a3cd4-79d1-4fcf-919b-ab927450381f@huawei.com> Date: Thu, 19 Sep 2024 09:07:27 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v24 03/15] windows: add os shim for localtime_r To: Stephen Hemminger , CC: Tyler Retzlaff , =?UTF-8?Q?Morten_Br=C3=B8rup?= , Bruce Richardson References: <20200814173441.23086-1-stephen@networkplumber.org> <20240918205324.35449-1-stephen@networkplumber.org> <20240918205324.35449-4-stephen@networkplumber.org> Content-Language: en-US From: fengchengwen In-Reply-To: <20240918205324.35449-4-stephen@networkplumber.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.121.161] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500024.china.huawei.com (7.185.36.10) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Acked-by: Chengwen Feng On 2024/9/19 4:52, 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 > Acked-by: Tyler Retzlaff > Acked-by: Morten Brørup > Acked-by: Bruce Richardson > --- > 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..665c9ac93b 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 *timep, struct tm *result) > +{ > + if (localtime_s(result, timep) == 0) > + return result; > + else > + return NULL; > +} > +#define localtime_r(timep, result) rte_localtime_r(timep, result) > + > #endif /* _RTE_OS_SHIM_ */