From 34e679f3c63fcda301f3faf654c580721a10c070 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 19 Mar 2015 18:03:35 -0700 Subject: Fix if server time is skewed by a small amount --- src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } } -- cgit v1.2.3