1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Work around cases where mail was last checked in the future.

Sometimes, user devices will have their clock misset. Previously, K-9
would just stop checking mail until the device caught up with the
future.
This commit is contained in:
Jesse Vincent 2011-09-05 16:43:11 -04:00
parent 7d5bb99dbd
commit cbaa9f5b3d

View File

@ -221,6 +221,13 @@ public class MailService extends CoreService {
SharedPreferences sPrefs = prefs.getPreferences();
int previousInterval = sPrefs.getInt(PREVIOUS_INTERVAL, -1);
long lastCheckEnd = sPrefs.getLong(LAST_CHECK_END, -1);
if (lastCheckEnd > System.currentTimeMillis()) {
Log.i(K9.LOG_TAG, "The database claims that the last time mail was checked was in the future. ("+lastCheckEnd+"). To try to get things back to normal, the last check time has been reset to "+System.currentTimeMillis());
lastCheckEnd = System.currentTimeMillis();
}
for (Account account : prefs.getAccounts()) {
if (account.getAutomaticCheckIntervalMinutes() != -1
&& account.getFolderSyncMode() != FolderMode.NONE