From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c06::241; helo=mail-io0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 86295209859B5 for ; Thu, 31 May 2018 07:28:05 -0700 (PDT) Received: by mail-io0-x241.google.com with SMTP id e15-v6so17613370iog.1 for ; Thu, 31 May 2018 07:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=1r8Z1f1NtARpiGl/DBHbLR760ucW290MFjkKRLhD4pg=; b=BtJ5UumwTjut3FtAbLbnHCVH8DCVDzSUj8HTvam8OcZQajopcUSrSAmyIWDw67f1E/ bJ0uznBytVvz+bh01SSDOJ3v5qnXaaDTfqOV7G94S5/ktm9Y9vEZ30D5khtGuPRgaYjN /r0u1q1eCr5pC1S/iCfiIlnq2IjunvJR1etFo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1r8Z1f1NtARpiGl/DBHbLR760ucW290MFjkKRLhD4pg=; b=bVmL08vdZM9ai5hU3+N76efP5GMqHny+pI91vriCQtC2D44CycboO6kSwRCv98i1F+ svIDNtyc/upLUvQwwvs1MCl7KhlTsNe6sjZ2/Bbl3erhBF52AHEdNFdifcNtZdt3s6ch /A5HuV+xXy7iEscpiQYiwmAy5L2FzLMiUfbqtnq7b60B3MC764W/P5/3Qx0iR7krK3n2 fNaA4MrOBrzOlmQXEKHeHfl5xpHczqNdLg3teNujqADPUApqhJwg0+YMYDlr5Hmb31k8 OT64XkocBcNWGAg/CSE0oPW/wA0+4tqOPl8H++6HkyKq3bpjSfsOnISKf/77GidR+d7p 74bA== X-Gm-Message-State: APt69E0CdJ2BroIF1ltYBz26hwbL2wqtNAq+Dku1p63eZHrHhKdQNdXK jpiEFwJdjs1gOwQNEwomaZGUre38Q3LJpdcmWEh8og== X-Google-Smtp-Source: ADUXVKIu0TgZeUnKeSZIJkpsBb2EoUStKxA6aRreIg5ZMVnydYmyFtM2ZoC/TepEz9Oz22Y+7F7rUaT38vOv1c2CcU4= X-Received: by 2002:a6b:6709:: with SMTP id b9-v6mr6435549ioc.170.1527776884381; Thu, 31 May 2018 07:28:04 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:bb86:0:0:0:0:0 with HTTP; Thu, 31 May 2018 07:28:03 -0700 (PDT) In-Reply-To: <1527796029-10160-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1527786160-9755-1-git-send-email-meenakshi.aggarwal@nxp.com> <1527796029-10160-1-git-send-email-meenakshi.aggarwal@nxp.com> From: Ard Biesheuvel Date: Thu, 31 May 2018 16:28:03 +0200 Message-ID: To: Meenakshi Aggarwal Cc: Leif Lindholm , "edk2-devel@lists.01.org" , Vabhav Sharma Subject: Re: [PATCH v2] EmbeddedPkg/TimeBaseLib: Add function to get Week day. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 14:28:05 -0000 Content-Type: text/plain; charset="UTF-8" On 31 May 2018 at 21:47, Meenakshi Aggarwal wrote: > This patch add function EfiTimeToWday() which returns > day of the week. > It is needed by our upcoming patches in edk2-platforms. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Meenakshi Aggarwal > Signed-off-by: Vabhav Sharma Actually, what is Vabhav's involvement in this patch? If he is the co-author of the patch, you are welcome to mention him in the commit log. But adding a signed-off-by implies that it is he who took your patch and sent it to the mailing list, which is obviously not the case > --- > EmbeddedPkg/Include/Library/TimeBaseLib.h | 8 ++++++ > EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c | 38 ++++++++++++++++++++++++--- > 2 files changed, 43 insertions(+), 3 deletions(-) > > diff --git a/EmbeddedPkg/Include/Library/TimeBaseLib.h b/EmbeddedPkg/Include/Library/TimeBaseLib.h > index fe3618e..dd0b99f 100644 > --- a/EmbeddedPkg/Include/Library/TimeBaseLib.h > +++ b/EmbeddedPkg/Include/Library/TimeBaseLib.h > @@ -65,4 +65,12 @@ EfiTimeToEpoch ( > IN EFI_TIME *Time > ); > > +/** > + returns Day of the week [0-6] 0=Sunday > + **/ > +UINTN > +EfiTimeToWday ( > + IN EFI_TIME *Time > + ); > + > #endif > diff --git a/EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c b/EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c > index 0c0d940..5f2bf65 100644 > --- a/EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c > +++ b/EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c > @@ -77,11 +77,11 @@ EpochToEfiTime ( > } > > /** > - Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) > + Calculate Epoch days > **/ > UINTN > EFIAPI > -EfiTimeToEpoch ( > +EfiGetEpochDays ( > IN EFI_TIME *Time > ) > { > @@ -90,7 +90,6 @@ EfiTimeToEpoch ( > UINTN m; > UINTN JulianDate; // Absolute Julian Date representation of the supplied Time > UINTN EpochDays; // Number of days elapsed since EPOCH_JULIAN_DAY > - UINTN EpochSeconds; > > a = (14 - Time->Month) / 12 ; > y = Time->Year + 4800 - a; > @@ -101,11 +100,44 @@ EfiTimeToEpoch ( > ASSERT (JulianDate >= EPOCH_JULIAN_DATE); > EpochDays = JulianDate - EPOCH_JULIAN_DATE; > > + return EpochDays; > +} > +/** > + Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) > + **/ > +UINTN > +EFIAPI > +EfiTimeToEpoch ( > + IN EFI_TIME *Time > + ) > +{ > + UINTN EpochDays; // Number of days elapsed since EPOCH_JULIAN_DAY > + UINTN EpochSeconds; > + > + EpochDays = EfiGetEpochDays (Time); > + > EpochSeconds = (EpochDays * SEC_PER_DAY) + ((UINTN)Time->Hour * SEC_PER_HOUR) + (Time->Minute * SEC_PER_MIN) + Time->Second; > > return EpochSeconds; > } > > +/** > + returns Day of the week [0-6] 0=Sunday > + **/ > +UINTN > +EfiTimeToWday ( > + IN EFI_TIME *Time > + ) > +{ > + UINTN EpochDays; // Number of days elapsed since EPOCH_JULIAN_DAY > + > + EpochDays = EfiGetEpochDays (Time); > + > + // 4=1/1/1970 was a Thursday > + > + return (EpochDays + 4) % 7; > +} > + > BOOLEAN > EFIAPI > IsLeapYear ( > -- > 1.9.1 >