Skip to contentSkip to conversation

rtc-efi: avoid subtract day twice when computing year days

PATCH New Lee, Chun-Yi 1 participant 1 message Apr 2, 2014 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc-efi: avoid subtract day twice when computing year days

Compared source code of rtc-lib.c::rtc_year_days() with efirtc.c::rtc_year_days(), found the code in rtc-efi decreases value of day twice when it computing year days. The tc-lib.c::rtc_year_days() has already decrease day and return the year days from 0 to 365.

---
 drivers/rtc/rtc-efi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/rtc/rtc-efi.c +1 -1
index 797aa02..c4c3843 100644
@@ -35,7 +35,7 @@ static inline int
 compute_yday(efi_time_t *eft)
 {
 	/* efi_time_t.month is in the [1-12] so, we need -1 */
-	return rtc_year_days(eft->day - 1, eft->month - 1, eft->year);
+	return rtc_year_days(eft->day, eft->month - 1, eft->year);
 }
 /*
  * returns day of the week [0-6] 0=Sunday
Signature · 1 line
1.6.4.2