aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-03-19 18:03:35 -0700
committerScott Jackson <daneren2005@gmail.com>2015-03-19 18:03:35 -0700
commit34e679f3c63fcda301f3faf654c580721a10c070 (patch)
tree28ba2aa15e780371655703912138b3e395b523e5 /src
parent806d0ea1e16639182ac190b2472d43df2f84518a (diff)
downloaddsub-34e679f3c63fcda301f3faf654c580721a10c070.tar.gz
dsub-34e679f3c63fcda301f3faf654c580721a10c070.tar.bz2
dsub-34e679f3c63fcda301f3faf654c580721a10c070.zip
Fix if server time is skewed by a small amount
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index edb7f2c9..791fa1c6 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -81,6 +81,8 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
private static String TAG = SubsonicFragmentActivity.class.getSimpleName();
private static boolean infoDialogDisplayed;
private static boolean sessionInitialized = false;
+ private static long ALLOWED_SKEW = 30000L;
+
private ScheduledExecutorService executorService;
private View bottomBar;
private View coverArtView;
@@ -564,8 +566,10 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
// If we had a remote state and it's changed is more recent than our existing state
if(remoteState != null && remoteState.changed != null) {
+ // Check if changed + 30 seconds since some servers have slight skew
+ Date remoteChange = new Date(remoteState.changed.getTime() - ALLOWED_SKEW);
Date localChange = downloadService.getLastStateChanged();
- if(localChange == null || localChange.before(remoteState.changed)) {
+ if(localChange == null || localChange.before(remoteChange)) {
playerQueue = remoteState;
}
}