Fixed how the autosync offset was being calculated.

Really, how did this work before? Oh well, that's why we code review... =/
pull/14/head
Tim Su 16 years ago
parent 89959b7784
commit c2ec12b343

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timsu.astrid" package="com.timsu.astrid"
android:versionCode="108" android:versionCode="110"
android:versionName="2.8.3"> android:versionName="2.8.4">
<!-- ============================ Metadata ============================ --> <!-- ============================ Metadata ============================ -->

@ -100,12 +100,10 @@ public class SynchronizationService extends Service {
latestSyncMillis = lastAutoSyncDate.getTime(); latestSyncMillis = lastAutoSyncDate.getTime();
long offset = 0; long offset = 0;
if(latestSyncMillis != 0) if(latestSyncMillis != 0)
offset = Math.min(offset, Math.max(0, latestSyncMillis + interval - offset = Math.max(0, latestSyncMillis + interval - System.currentTimeMillis());
System.currentTimeMillis()));
// give a little padding // give a little padding
offset = Math.max(offset, AUTO_SYNC_MIN_OFFSET); offset = Math.max(offset, AUTO_SYNC_MIN_OFFSET);
offset = AUTO_SYNC_MIN_OFFSET;
timer.scheduleAtFixedRate(new TimerTask() { timer.scheduleAtFixedRate(new TimerTask() {
@Override @Override

Loading…
Cancel
Save