package org.robockets.buttonmanger;

public class ButtonThread implements Runnable {
	private long startTime = 0;

	public void run() {
		while (true) {
			setTimeout();
			ButtonManager.checkButtons();
			waitUntilTimedOut();
		}
	}
	
	private void setTimeout() {
		startTime = System.nanoTime();
	}
	
	private void waitUntilTimedOut() {
		while (System.nanoTime() >= startTime + 10000000) { // 10000000ns should be 10ms
			// Just wait
		}
	}
}

@@ -82,38 +82,8 @@
 e %7B%0A
-%09private long startTime = 0;%0A%0A
 %09pub
@@ -120,25 +120,8 @@
 ) %7B%0A
-%09%09%09setTimeout();%0A
 %09%09%09B
@@ -156,239 +156,107 @@
 %0A%09%09%09
-waitUntilTimedOut();%0A%09%09%7D%0A%09%7D%0A%09%0A%09private void setTimeout() %7B%0A%09%09startTime = System.nanoTime();%0A%09%7D%0A%09%0A%09private void waitUntilTimedOut() %7B%0A%09%09while (System.nanoTime() %3E= startTime + 10000000) %7B // 10000000ns should be 10ms%0A%09%09%09// Just wait
+%0A%09%09%09try %7B%0A%09%09%09%09Thread.sleep(10);%0A%09%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09%09e.printStackTrace();%0A%09%09%09%7D
 %0A%09%09%7D

Fix button thread timeouts