Created
June 4, 2012 04:00
-
-
Save aragaer/2866249 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| long passed, next; | |
| /* adjust the transition */ | |
| do { | |
| passed = System.currentTimeMillis() - sync; | |
| Log.d(TAG, "Adjust at "+l2s(passed+sync)+", sync was at "+l2s(sync)+" "+passed+"ms passed"); | |
| if (tr.isEmpty()) { | |
| /* request more items */ | |
| exhausted(); | |
| if (tr.isEmpty()) { | |
| Log.d(TAG, "no transitions"); | |
| return; | |
| } | |
| passed = System.currentTimeMillis() - sync; | |
| } | |
| next = tr.get(0); | |
| Log.d(TAG, "next would be in "+next+"ms at "+l2s(sync+next)); | |
| if (passed > next) { | |
| /* we can now ignore previous tick/sub values | |
| * we will notify about transition anyway | |
| * this allows us to simply move sync time | |
| */ | |
| sync += next; | |
| tr0 = sync; | |
| tr.remove(); | |
| tr_changed = true; | |
| } | |
| } while (passed > next); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment