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 E2781A0A0A; Wed, 24 Mar 2021 01:50:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 031ED140D06; Wed, 24 Mar 2021 01:50:27 +0100 (CET) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by mails.dpdk.org (Postfix) with ESMTP id 7F7A840684 for ; Wed, 24 Mar 2021 01:50:25 +0100 (CET) Received: by mail-lj1-f181.google.com with SMTP id a1so28079578ljp.2 for ; Tue, 23 Mar 2021 17:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tPYp4UHPDjap8f+ROzV5qB5ZtlJVeYKsQsIQSQcx8g0=; b=lka6ajvlNfHJM47QJlRoEPj6C3131a5GJw12u17fY2rHw3dYErq52Cu6GHQb8k3Cx+ a/I4Yr4S7prt1XNBaZW24ubflrttXBlF//ZWmmg88xBohNTwHYwtkeo9MfyXcl34aeea VLnPb7FwROjroyJRHd1KUrRWkZbBB0PBemfYSNXTocdU1tha44jMZAFX2fXD+fWSkaWR 3bwQkPaQny73kB4YyX1MOX2rXkxUhuz705gkg8KpPmnlelqEABDh0HqkaflOxx/lZSeQ 0kJ2aNFrphRFLmgpCgT4KRlXbd7GOqyX8fvPxI81hgrBuTpt7EjLg6vbCidi8Uh8abSJ f1Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tPYp4UHPDjap8f+ROzV5qB5ZtlJVeYKsQsIQSQcx8g0=; b=kpsHmHxMfxbrqziHGVOEjp9j6eynBSwUA9Wqk2lBW9eIbNYzhnaXfjU7Mt3jUjIjCN zoU+c9DV8Lp9BgYEv5Rk4YWR7uJ0Y0q94pLFPfB/YYW+92FqMFpOKaXkjXFaWl1jch/U 0XA1OgLrNyaeIAMCEOQM4oi0qpWhE57rCLL3VP7smsW+yO9cKQ/zlAvbLqjB/TYdMjhZ lp81CckWN0FXs0s/yooGIPY4wB8aBtRi8CvdJJ3JTQ+TMa+/tJ3hj/11IJDIzwWoO03R y3VqLSzw3DZgbCkmshv+x/D1ec9+CIyypqyJjlbzvK3uqNl+nXkhKk0fWwYdstb4TLSY s+UA== X-Gm-Message-State: AOAM531+zn38Y3792HaG46yqVc79b0bHw5Tu8BIPs0XgX45bSHn5STaO Jjc6nD0FeAysPKM0DtsLXIlNG7jUnvztl4y0 X-Google-Smtp-Source: ABdhPJwuCGgwtmTeXVb3bHfj5eRBggaXiLop5B5GYzFT9+W/6wdV8knyzGSAwFMSzJahHx/3BMr6gw== X-Received: by 2002:a2e:b4c7:: with SMTP id r7mr336572ljm.462.1616547024901; Tue, 23 Mar 2021 17:50:24 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id q12sm89794ljj.49.2021.03.23.17.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 17:50:24 -0700 (PDT) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Nick Connolly , Mike Wells , Tyler Retzlaff , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Date: Wed, 24 Mar 2021 03:50:05 +0300 Message-Id: <20210324005008.24705-2-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20210324005008.24705-1-dmitry.kozliuk@gmail.com> References: <20210214021616.26970-1-dmitry.kozliuk@gmail.com> <20210324005008.24705-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 1/3] eal/windows: add timespec_get shim for MinGW 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 Sender: "dev" MinGW-w64 does not currently implement C11 timespec_get. Add an internal shim until this is fixed on MinGW side. Signed-off-by: Dmitry Kozlyuk --- .../windows/include/rte_os_internal.h | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/librte_eal/windows/include/rte_os_internal.h b/lib/librte_eal/windows/include/rte_os_internal.h index 89ac5c9cbd..df37eb6cf7 100644 --- a/lib/librte_eal/windows/include/rte_os_internal.h +++ b/lib/librte_eal/windows/include/rte_os_internal.h @@ -3,7 +3,10 @@ #ifndef _RTE_OS_INTERNAL_H_ #define _RTE_OS_INTERNAL_H_ +#include + #include +#include /** * @file @@ -33,4 +36,33 @@ #define IPPROTO_SCTP 132 #endif +#ifdef RTE_TOOLCHAIN_GCC + +#define TIME_UTC 1 + +static inline int +rte_timespec_get(struct timespec *now, int base) +{ + /* 100ns ticks from 1601-01-01 to 1970-01-01 */ + static const uint64_t EPOCH = 116444736000000000ULL; + static const uint64_t TICKS_PER_SEC = 10000000; + static const uint64_t NS_PER_TICK = 100; + + FILETIME ft; + uint64_t ticks; + + if (base != TIME_UTC) + return 0; + + GetSystemTimePreciseAsFileTime(&ft); + ticks = ((uint64_t)ft.dwHighDateTime << 32) | ft.dwLowDateTime; + ticks -= EPOCH; + now->tv_sec = ticks / TICKS_PER_SEC; + now->tv_nsec = (ticks - now->tv_sec * TICKS_PER_SEC) * NS_PER_TICK; + return base; +} + +#define timespec_get(ts, base) rte_timespec_get(ts, base) + +#endif /* RTE_TOOLCHAIN_GCC */ #endif /* _RTE_OS_INTERNAL_H_ */ -- 2.29.3