Check the crash counter instead of date in TWFunc::Fixup_Time_On_Boot()
* Some devices (Sony) have RTC counting up from year 2009, Change-Id: I2cf1928e1b05c7e8b184963f8130582e0319ddc4 Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
This commit is contained in:
committed by
Gerrit Code Review
parent
0fc1573730
commit
67351dca66
@@ -1094,16 +1094,6 @@ void TWFunc::Fixup_Time_On_Boot()
|
||||
struct dirent *dt;
|
||||
std::string ats_path;
|
||||
|
||||
|
||||
// Don't fix the time of it already is over year 2000, it is likely already okay, either
|
||||
// because the RTC is fine or because the recovery already set it and then crashed
|
||||
gettimeofday(&tv, NULL);
|
||||
if(tv.tv_sec > 946684800) // timestamp of 2000-01-01 00:00:00
|
||||
{
|
||||
LOGINFO("TWFunc::Fixup_Time: not fixing time, it seems to be already okay (after year 2000).\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!PartitionManager.Mount_By_Path("/data", false))
|
||||
return;
|
||||
|
||||
|
||||
@@ -273,7 +273,8 @@ int main(int argc, char **argv) {
|
||||
DataManager::ReadSettingsFile();
|
||||
|
||||
// Fixup the RTC clock on devices which require it
|
||||
TWFunc::Fixup_Time_On_Boot();
|
||||
if(crash_counter == 0)
|
||||
TWFunc::Fixup_Time_On_Boot();
|
||||
|
||||
// Run any outstanding OpenRecoveryScript
|
||||
if (DataManager::GetIntValue(TW_IS_ENCRYPTED) == 0 && (TWFunc::Path_Exists(SCRIPT_FILE_TMP) || TWFunc::Path_Exists(SCRIPT_FILE_CACHE))) {
|
||||
|
||||
Reference in New Issue
Block a user