From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.groups.io with SMTP id smtpd.web11.9582.1596456555799807104 for ; Mon, 03 Aug 2020 05:09:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=JahJJXwj; spf=pass (domain: nuviainc.com, ip: 209.85.128.68, mailfrom: leif@nuviainc.com) Received: by mail-wm1-f68.google.com with SMTP id g8so14116328wmk.3 for ; Mon, 03 Aug 2020 05:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Ivb9YY4myqNnzgzNmgKhUKJ6zNPBND/wZvXpXVqo9TA=; b=JahJJXwj7oBumgDKC9HmbL9k7A7uSTo1Pr3DifmSuC8jO3ZuxJ/CxJAwIgY2TPnxoX SxMxFzkbzDZf45u51R9bp6me0yRf5UX/WtjFrf58we/oe/qVJwaI7HQWdclwxg+FoQBT OhjhjFtvg8/Ocz16x4UG+w6vPTQteqd2uCz11tOYXikToB2bntmW772pNVSAixnZhYYb HvhAIuSwkkb+Hbsh9e1ZFUIDhR37qd13zWL4dDMW/PjwHu5ZZA30ZhuqNy2I8kBqhaOx q7jbh44b/6s05XZSTt2irSF8+rg9YynVBcSYsc+oXCTxb9urILaOFtPgTEUgbclKeB3f AABg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Ivb9YY4myqNnzgzNmgKhUKJ6zNPBND/wZvXpXVqo9TA=; b=I+xSQwWjc88lDFBrykqMyTEJNEoD9O/UcbFe1HZjygU33BRgk9l5n5CQp6Uo7QGJU2 MxjBr24+d2wzTDqp/pla2UcSguPqJ82sGKUbA6jTkKPpOG04sGTmT9KInEAVEPxQ9z5a CnrPMqzUx1DATPkNvLIPzF7zExXUPV49rlSnzR+ItIqfRYQIde+hG229knflSOGX8wiS bl45wCr1j4ijJFM0W9ERGVTQfYZzw61BeU1zlJxCO1Pxf6Bw56c+txFQ3QKB/uJ2gDnF jC1riC/pPoIjN6J/yP/eQdt5gx2ppR+gD6uyeW2zDSUTzlUiCPJxJZzZHyZoDVg+JpCb OPqA== X-Gm-Message-State: AOAM531jOTfwTqPzIKV2g6UigWgx8ul61WLcDS0PWMFBw93YbyYGczYk JshFdw8She9Bx+UNXF+z/ekdQg== X-Google-Smtp-Source: ABdhPJwacA9dX5kNJTDUhWbFUs0jAzZ59/BpiWfo3Hqo9LFI/IaFltzOBNHHqrk9KFRXjc4bvD4TUA== X-Received: by 2002:a1c:6002:: with SMTP id u2mr15472626wmb.170.1596456554281; Mon, 03 Aug 2020 05:09:14 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id n189sm23818399wmn.40.2020.08.03.05.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 05:09:13 -0700 (PDT) Date: Mon, 3 Aug 2020 13:09:11 +0100 From: "Leif Lindholm" To: Pete Batard Cc: devel@edk2.groups.io, ard.biesheuvel@arm.com Subject: Re: [PATCH 1/1] EmbeddedPkg/TimeBaseLib: Add macros to get build year/month/day Message-ID: <20200803120911.GX31778@vanye> References: <20200724163742.5828-1-pete@akeo.ie> MIME-Version: 1.0 In-Reply-To: <20200724163742.5828-1-pete@akeo.ie> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Pete, Well prodded (off-list). I expect I saw that arrive, expected the corresponding RPi resubmission to arrive shortly afterwards for me to test with and put it soundly at the back of my mind. Presumably you were waiting for this to be merged before resubmitting that one? Anyway: Reviewed-by: Leif Lindholm Pushed as bbb8a8185838. Regards, Leif On Fri, Jul 24, 2020 at 17:37:42 +0100, Pete Batard wrote: > These can be used, for instance, to automate the population of an SMBIOS > Type 0 BIOS Release Date when building a UEFI firmware (which is how we > plan to use these macros for the Raspberry Pi platform). > > These macros should work for any compiler that follows ISO/IEC 9899, but > we add a check for the compiler we have tested to be on the safe side. > > Note that we decided against adding a #error or #warn for compilers that > haven't been validated, as we don't want to introduce breakage for people > who may already be using the header with something else than gcc, MSVC or > Clang. Instead, we expect those to send a patch that adds their compiler > to the list, once they have tested the macros there. > > Signed-off-by: Pete Batard > --- > EmbeddedPkg/Include/Library/TimeBaseLib.h | 32 ++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/EmbeddedPkg/Include/Library/TimeBaseLib.h b/EmbeddedPkg/Include/Library/TimeBaseLib.h > index 4103c89b3891..ee2f191d985b 100644 > --- a/EmbeddedPkg/Include/Library/TimeBaseLib.h > +++ b/EmbeddedPkg/Include/Library/TimeBaseLib.h > @@ -12,6 +12,38 @@ > > #include > > +// > +// Convenience macros to obtain a build date > +// > +// These macros should work for any compiler that follows ISO/IEC 9899, > +// in which case __DATE__ is defined as a "Mmm dd yyyy" 11 chars string, > +// but add an explicit filter for compilers that have been validated. > +// > +#if (defined(__GNUC__) || defined(_MSC_VER) || defined(__clang__)) > +#define TIME_BUILD_YEAR (__DATE__[7] == '?' ? 1900 \ > + : (((__DATE__[7] - '0') * 1000 ) \ > + + (__DATE__[8] - '0') * 100 \ > + + (__DATE__[9] - '0') * 10 \ > + + __DATE__[10] - '0')) > +#define TIME_BUILD_MONTH ( __DATE__ [2] == '?' ? 1 \ > + : __DATE__ [2] == 'n' ? ( \ > + __DATE__ [1] == 'a' ? 1 : 6) \ > + : __DATE__ [2] == 'b' ? 2 \ > + : __DATE__ [2] == 'r' ? ( \ > + __DATE__ [0] == 'M' ? 3 : 4) \ > + : __DATE__ [2] == 'y' ? 5 \ > + : __DATE__ [2] == 'l' ? 7 \ > + : __DATE__ [2] == 'g' ? 8 \ > + : __DATE__ [2] == 'p' ? 9 \ > + : __DATE__ [2] == 't' ? 10 \ > + : __DATE__ [2] == 'v' ? 11 \ > + : 12) > +#define TIME_BUILD_DAY ( __DATE__[4] == '?' ? 1 \ > + : ((__DATE__[4] == ' ' ? 0 : \ > + ((__DATE__[4] - '0') * 10)) \ > + + __DATE__[5] - '0')) > +#endif > + > // Define EPOCH (1970-JANUARY-01) in the Julian Date representation > #define EPOCH_JULIAN_DATE 2440588 > > -- > 2.21.0.windows.1 >