gmtimer: Fixed range of tm_yday.
This commit is contained in:
parent
55106685fa
commit
f9fd53cda1
|
@ -815,7 +815,7 @@ int up_rtc_getdatetime(struct tm *tp)
|
|||
|
||||
tmp = (dr & RTC_DR_WDU_MASK) >> RTC_DR_WDU_SHIFT;
|
||||
tp->tm_wday = tmp % 7;
|
||||
tp->tm_yday = tp->tm_mday +
|
||||
tp->tm_yday = tp->tm_mday - 1 +
|
||||
clock_daysbeforemonth(tp->tm_mon,
|
||||
clock_isleapyear(tp->tm_year + 1900));
|
||||
tp->tm_isdst = 0;
|
||||
|
|
|
@ -1205,7 +1205,7 @@ int up_rtc_getdatetime(struct tm *tp)
|
|||
|
||||
tmp = (dr & RTC_DR_WDU_MASK) >> RTC_DR_WDU_SHIFT;
|
||||
tp->tm_wday = tmp % 7;
|
||||
tp->tm_yday = tp->tm_mday +
|
||||
tp->tm_yday = tp->tm_mday - 1 +
|
||||
clock_daysbeforemonth(tp->tm_mon,
|
||||
clock_isleapyear(tp->tm_year + 1900));
|
||||
tp->tm_isdst = 0;
|
||||
|
|
|
@ -1127,7 +1127,7 @@ int stm32_rtc_getdatetime_with_subseconds(struct tm *tp, long *nsec)
|
|||
|
||||
tmp = (dr & RTC_DR_WDU_MASK) >> RTC_DR_WDU_SHIFT;
|
||||
tp->tm_wday = tmp % 7;
|
||||
tp->tm_yday = tp->tm_mday +
|
||||
tp->tm_yday = tp->tm_mday - 1 +
|
||||
clock_daysbeforemonth(tp->tm_mon,
|
||||
clock_isleapyear(tp->tm_year + 1900));
|
||||
tp->tm_isdst = 0;
|
||||
|
|
|
@ -1180,7 +1180,7 @@ int up_rtc_getdatetime(struct tm *tp)
|
|||
|
||||
tmp = (dr & RTC_DR_WDU_MASK) >> RTC_DR_WDU_SHIFT;
|
||||
tp->tm_wday = tmp % 7;
|
||||
tp->tm_yday = tp->tm_mday +
|
||||
tp->tm_yday = tp->tm_mday - 1 +
|
||||
clock_daysbeforemonth(tp->tm_mon, clock_isleapyear(tp->tm_year + 1900));
|
||||
tp->tm_isdst = 0;
|
||||
|
||||
|
|
|
@ -1180,7 +1180,7 @@ int up_rtc_getdatetime(struct tm *tp)
|
|||
|
||||
tmp = (dr & RTC_DR_WDU_MASK) >> RTC_DR_WDU_SHIFT;
|
||||
tp->tm_wday = tmp % 7;
|
||||
tp->tm_yday = tp->tm_mday +
|
||||
tp->tm_yday = tp->tm_mday - 1 +
|
||||
clock_daysbeforemonth(tp->tm_mon, clock_isleapyear(tp->tm_year + 1900));
|
||||
tp->tm_isdst = 0;
|
||||
|
||||
|
|
|
@ -1091,7 +1091,7 @@ int stm32l4_rtc_getdatetime_with_subseconds(struct tm *tp,
|
|||
|
||||
tmp = (dr & RTC_DR_WDU_MASK) >> RTC_DR_WDU_SHIFT;
|
||||
tp->tm_wday = tmp % 7;
|
||||
tp->tm_yday = tp->tm_mday +
|
||||
tp->tm_yday = tp->tm_mday - 1 +
|
||||
clock_daysbeforemonth(tp->tm_mon,
|
||||
clock_isleapyear(tp->tm_year + 1900));
|
||||
tp->tm_isdst = 0;
|
||||
|
|
|
@ -1078,7 +1078,7 @@ int stm32wb_rtc_getdatetime_with_subseconds(struct tm *tp,
|
|||
|
||||
tmp = (dr & RTC_DR_WDU_MASK) >> RTC_DR_WDU_SHIFT;
|
||||
tp->tm_wday = tmp % 7;
|
||||
tp->tm_yday = tp->tm_mday +
|
||||
tp->tm_yday = tp->tm_mday - 1 +
|
||||
clock_daysbeforemonth(tp->tm_mon,
|
||||
clock_isleapyear(tp->tm_year + 1900));
|
||||
tp->tm_isdst = 0;
|
||||
|
|
|
@ -334,7 +334,7 @@ FAR struct tm *gmtime_r(FAR const time_t *timep, FAR struct tm *result)
|
|||
result->tm_sec = (int)sec;
|
||||
|
||||
result->tm_wday = clock_dayoftheweek(day, month, year);
|
||||
result->tm_yday = day +
|
||||
result->tm_yday = day - 1 +
|
||||
clock_daysbeforemonth(result->tm_mon,
|
||||
clock_isleapyear(year));
|
||||
result->tm_isdst = 0;
|
||||
|
|
Loading…
Reference in New Issue