mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
RTCオフセット計算時にRTCの日付・時刻取得に失敗した時に、3回までリトライを行うよう変更。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2458 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
332084bf23
commit
e223cd5980
@ -140,12 +140,24 @@ s64 UTL_CalcRTCOffset( RTCDate *newDatep, RTCTime *newTimep )
|
||||
s64 offset1;
|
||||
s64 offset;
|
||||
u32 second_bak = newTimep->second;
|
||||
int retry = 3;
|
||||
|
||||
newTimep->second = 0;
|
||||
|
||||
// RTCへの新しい値の設定
|
||||
(void)RTC_GetDateTime( &oldDate, &oldTime ); // ライト直前に現在のRTC値を取得する。
|
||||
oldTime.second = 0;
|
||||
// ライト直前に現在のRTC値を取得する。
|
||||
while( retry > 0 ) {
|
||||
if( RTC_RESULT_SUCCESS == RTC_GetDateTime( &oldDate, &oldTime ) ) {
|
||||
oldTime.second = 0;
|
||||
break;
|
||||
}
|
||||
OS_Sleep(1);
|
||||
retry--;
|
||||
}
|
||||
if( retry == 0 ) {
|
||||
// 現在時刻の取得に失敗した時は、新しいセット値を古い値にも使う
|
||||
MI_CpuCopy8( newDatep, &oldDate, sizeof(RTCDate) );
|
||||
MI_CpuCopy8( newTimep, &oldTime, sizeof(RTCTime) );
|
||||
}
|
||||
|
||||
// RTC設定時は、今回の設定でどれだけRTC値が変化したか(秒オフセット単位)を算出。
|
||||
if( ( oldDate.year < LCFG_TSD_GetRTCLastSetYear() ) && ( LCFG_TSD_IsFinishedInitialSetting() ) ) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user