Message ID | 20240327164726.68732-4-stephen@networkplumber.org (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Thomas Monjalon |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6FC6943D55; Wed, 27 Mar 2024 17:47:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C16D8410E6; Wed, 27 Mar 2024 17:47:41 +0100 (CET) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id DCC0F40A84 for <dev@dpdk.org>; Wed, 27 Mar 2024 17:47:38 +0100 (CET) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6ea9a605ca7so66637b3a.0 for <dev@dpdk.org>; Wed, 27 Mar 2024 09:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1711558058; x=1712162858; 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=Ml0gchs9dNogvSJKCUa91H765fGAaDYpR/DhR359d/Q=; b=QNKFfUEKW7/sRg4LeJO+WfQO+sv+Lamt6ihIijGEcd3a2HTfitPXzskXaLrXk9gb5B AkyfBDizEy5E97k7mf9YIhc92sobfvjQEVNirQt5oBvHOKfoYZeOPLZDoFzJC3+6Hxxp oya81htxrD9iX0aWk/DTFjG9C8EMg/itmshAXc4eHaNCIYBC/6z8IemBDIdA4I6BSW82 UA5oK7wViRwvXmQs94sAJ5GqD3ry7zKCLIlM11YuDNDxo4ec041DQC0lPo6Wwp6Ph9f5 rJ9/anc16VxA1ktsij/4xQ9bbYAX1/FdRWknnXiiePzPQnFKuLMnOO/3NiOI5rHZa4/5 tfuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711558058; x=1712162858; 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=Ml0gchs9dNogvSJKCUa91H765fGAaDYpR/DhR359d/Q=; b=MkV/O12PlhSNwBBiiaFz8kErt3SdJuSrxjJAOasjeCjCc9W63lG3dvsens6LyfeUH/ ik2nZD5Kjdi55BTbOM2p2ajo2JeeXyczXKiPAPLLBPM7/aOxu6e+d4s1k2SHMEd4RJsc BBIwMH+IK7nmV8QLJjH3Z5qBxfZgKl0Gdkx4tPQwlOWxB0qNk8jAI5RLLPLyJvSgcFc7 fOld/hIA9499Ff65aNaTA+PbJxcewYSyttMIpTBcfJe8MGPEII2ZxzYGNUhs7dDSAgI4 Sk6uleVhX1ytXf6gMnJMQM+v7xbUePw3aDfCb2INr3nueDsuME/XAE1rW96qw7VqSS6W ytIg== X-Gm-Message-State: AOJu0Yy8Vv/V4gvmtIXeBHY2qhI8N7b7sg/SLOLsf2ykxEhuxFhvDO/8 i3aCRwc0bHC+sAVFkr8cq3IqMER2Z0J8MtdwCWNNfWmnYQMuQrSGtgHieg8/6TwvCZ/3yVXorvi n X-Google-Smtp-Source: AGHT+IFYUYSFJ4FCv5mzRBKIx7slGyyPfXRSK9NKOAWE4GBDE5FLDxRHwuogz7ri/VBAoitGh6ic3Q== X-Received: by 2002:a05:6a20:3d16:b0:1a3:b173:1a97 with SMTP id y22-20020a056a203d1600b001a3b1731a97mr265918pzi.1.1711558058060; Wed, 27 Mar 2024 09:47:38 -0700 (PDT) Received: from hermes.local (204-195-123-203.wavecable.com. [204.195.123.203]) by smtp.gmail.com with ESMTPSA id a33-20020a056a0011e100b006e580678dfbsm5160873pfu.193.2024.03.27.09.47.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 09:47:37 -0700 (PDT) From: Stephen Hemminger <stephen@networkplumber.org> To: dev@dpdk.org Cc: Stephen Hemminger <stephen@networkplumber.org>, Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>, Tyler Retzlaff <roretzla@linux.microsoft.com>, Pallavi Kadam <pallavi.kadam@intel.com> Subject: [PATCH v16 03/15] windows: add os shim for localtime_r Date: Wed, 27 Mar 2024 09:45:21 -0700 Message-ID: <20240327164726.68732-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240327164726.68732-1-stephen@networkplumber.org> References: <20200814173441.23086-1-stephen@networkplumber.org> <20240327164726.68732-1-stephen@networkplumber.org> MIME-Version: 1.0 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 |
Series |
Logging unification and improvements
|
|
Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | success | coding style OK |
Commit Message
Stephen Hemminger
March 27, 2024, 4:45 p.m. UTC
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>
---
lib/eal/windows/include/rte_os_shim.h | 10 ++++++++++
1 file changed, 10 insertions(+)
Comments
On Wed, Mar 27, 2024 at 09:45:21AM -0700, 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@networkplumber.org> > --- > 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) > +{ > + if (localtime_s(buf, timer) == 0) > + return buf; > + else > + return NULL; > +} > +#define localtime_r(timer, buf) rte_localtime_r(timer, buf) hm, i'm always a bit concerned about expressing platform standard names from dpdk api surface. i think we should just expose and use rte_localtime_r() and not present localtime_r. can be treated as a suggestion. Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
On Wed, 27 Mar 2024 09:56:59 -0700 Tyler Retzlaff <roretzla@linux.microsoft.com> wrote: > On Wed, Mar 27, 2024 at 09:45:21AM -0700, 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@networkplumber.org> > > --- > > 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) > > +{ > > + if (localtime_s(buf, timer) == 0) > > + return buf; > > + else > > + return NULL; > > +} > > +#define localtime_r(timer, buf) rte_localtime_r(timer, buf) > > hm, i'm always a bit concerned about expressing platform standard names > from dpdk api surface. i think we should just expose and use > rte_localtime_r() and not present localtime_r. > > can be treated as a suggestion. > > Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com> > I was just copying what clock_gettime was doing. But yes, should really do global update to rte_localtime()
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) +{ + 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_ */