All pastes #293630 Raw Edit

Something

public text v1 · immutable
#293630 ·published 2006-12-27 19:38 UTC
rendered paste body

	/**
	 * Get the accurate system time
	 * 
	 * @return The system time in milliseconds
	 */
	public static long getTime() {
		return (Sys.getTime() * 1000) / Sys.getTimerResolution();
	}
	
	private static long lastFPS;
	private static long recordedFPS;
	private static long fps;

	/**
	 * Updated the FPS counter
	 */
	public static  void updateFPS() {
		if (getTime() - lastFPS > 1000) {
			lastFPS = getTime();
			recordedFPS = fps;
			fps = 0;
			System.out.println("FPS: "+recordedFPS);
		}
		fps++;
	}