lib/rtc: Remove unnecessary year constraint in rtc_calc_weekday
Algorithm used to calculate weekday is now based on Zeller's rule, so it does not need if statement constraining year to 1971 and later. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I25e2e6a1c9b2fb1ac2576e028b580db0ea474d37 Reviewed-on: https://review.coreboot.org/c/coreboot/+/52347 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
This commit is contained in:
parent
a4819b3c31
commit
4ae7ee6e2b
|
@ -22,9 +22,6 @@ static const char *const weekdays[] = {
|
||||||
/* Zeller's rule */
|
/* Zeller's rule */
|
||||||
static int rtc_calc_weekday(struct rtc_time *tm)
|
static int rtc_calc_weekday(struct rtc_time *tm)
|
||||||
{
|
{
|
||||||
if (tm->year < 1971)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* In Zeller's rule, January and February are treated as if they
|
/* In Zeller's rule, January and February are treated as if they
|
||||||
are months 13 and 14 of the previous year (March is still month 3) */
|
are months 13 and 14 of the previous year (March is still month 3) */
|
||||||
const int zyear = ((tm->mon < 3) ? tm->year - 1 : tm->year);
|
const int zyear = ((tm->mon < 3) ? tm->year - 1 : tm->year);
|
||||||
|
|
Loading…
Reference in New Issue