package gameEngine; public class Time { public static long timeStarted = System.nanoTime(); private static long lastFrameTime = System.nanoTime(); public static float deltaTime = 0; public static float getTime(){return (float)((System.nanoTime() - timeStarted) * 1E-9); } public static void update() { long currentTime = System.nanoTime(); deltaTime = (float)((currentTime - lastFrameTime) * 1E-9); lastFrameTime = currentTime; } public static void reset() { timeStarted = System.nanoTime(); lastFrameTime = timeStarted; deltaTime = 0; } }