From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 4F4BC459D7;
	Thu, 19 Sep 2024 17:06:45 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 9230A43381;
	Thu, 19 Sep 2024 17:06:25 +0200 (CEST)
Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com
 [209.85.210.178])
 by mails.dpdk.org (Postfix) with ESMTP id A51A243379
 for <dev@dpdk.org>; Thu, 19 Sep 2024 17:06:22 +0200 (CEST)
Received: by mail-pf1-f178.google.com with SMTP id
 d2e1a72fcca58-719858156f4so762407b3a.3
 for <dev@dpdk.org>; Thu, 19 Sep 2024 08:06:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1726758382;
 x=1727363182; darn=dpdk.org; 
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=lxRrCvLT4Xv7g0jHDEOqMAqfGdL9jPEeURqKg/Cqh74=;
 b=bQABv6EPf0CWUtUM06QYjRCrdRM571CW8f1qN2GaNAL7lltNnZQVaxBqmLKfq+5Y1k
 StYFnNJ7d8YGGOqpluUpXDT8RJCPNvCFxSTgeIM6BTfPu0vh9tWB9fjzm49Zu/iEuqjf
 6z3aVVc4o0gp/ZDA+IO57Ni1yeMIAICV7jTPSark/Dyb/MFDN5AJMktJKjWHocbkudz9
 3SAHjyUCUsNdIWFpalJ0FgCj0ZUKuk+r2rcQEszmxczHtxGtJa49Yij+hqOtRDVMP9y0
 vI4K8Q41/0WO6bg2ukAoQKN3LVsaoxL1OEl+mq9EbtoBk1oCjudfqarb5U3X1bAZUE23
 PVMQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726758382; x=1727363182;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=lxRrCvLT4Xv7g0jHDEOqMAqfGdL9jPEeURqKg/Cqh74=;
 b=RfA1CIxgNpxc7WgAO82mp+I8+pIqT9nERcRWDJFqkaRBCk45uyCsmBoTWyYe0hrB46
 s3aC6NONgX7/rFuCp+KY2g+ZpXb/PhWoPseXDY01K9RLMdEjilLwM+c1RfAqSCL+wheU
 rszzffIuk0XLdzQI68C4LUnxsJY2eanaP43W8AluTzJoNV9RG7LxNMGub+rReMhs1ex6
 0SRnodtkSrLv1fi0LxB4Xx0eK875J9I3RolI0B6Kdy1fYjt3erF2PxdPd/G8liS4ZlPg
 t8ihginfY/tNmRkaZMzgAzLqS8CfCU8ecSomgdeuCu0UgnhH+zcgbqBHNYXeYzlRVWkG
 0yLg==
X-Gm-Message-State: AOJu0YzgZ0nbm9cTsSrODrpd4unXUynTvr3lVQhb5Y+hOAvnovgJgFym
 69b/QmEZXhrtCw1TwnAKW8TrfXRbAbXEORs/Cc1I5dE71ZYUeSRBEvAvRBPk3NWh8lj4tntt5dP
 j
X-Google-Smtp-Source: AGHT+IHui10DnSIKwMNgrCwg4tjgDa6HaY6F9e3pJiy3kci1LylR28XCQX/TS8O5U/7u4K2SdDe8Zg==
X-Received: by 2002:a05:6a00:14c8:b0:714:3de8:a616 with SMTP id
 d2e1a72fcca58-719261e1393mr38354400b3a.19.1726758381691; 
 Thu, 19 Sep 2024 08:06:21 -0700 (PDT)
Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-71944adfd3dsm8620841b3a.92.2024.09.19.08.06.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 19 Sep 2024 08:06:21 -0700 (PDT)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
 Tyler Retzlaff <roretzla@linux.microsoft.com>,
 =?UTF-8?q?Morten=20Br=C3=B8rup?= <mb@smartsharesystems.com>,
 Bruce Richardson <bruce.richardson@intel.com>,
 Chengwen Feng <fengchengwen@huawei.com>
Subject: [PATCH v25 03/15] windows: add os shim for localtime_r
Date: Thu, 19 Sep 2024 08:04:09 -0700
Message-ID: <20240919150609.5281-4-stephen@networkplumber.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20240919150609.5281-1-stephen@networkplumber.org>
References: <20200814173441.23086-1-stephen@networkplumber.org>
 <20240919150609.5281-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Windows does not have localtime_r but it does have a similar
function that can be used instead.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.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..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_ */
-- 
2.45.2