I am making a game in java, And I was wondering how I would get the delta time so the images and such rendered at the correct speed? The code I have does not work, and all it returns when printed out in a loop is 0.
public static long getTime() {
return (Sys.getTime() * 1000) / Sys.getTimerResolution();
}
public static int getDelta() {
long time = getTime();
int delta = (int) (time - lastFrame);
lastFrame = time;
return delta;
}