I am trying to convert code from Python to Java. I need to rewrite the timeDelta
function in Java. Here is the code in Python:
def timeDate(date):
As far as I know, Java doesn't have a built in DeltaTime function. However you can easily make your own.long startTime;
long delta;
public void deltaTime(){ long currentTime = System.currentTimeMillis(); delta = currentTime - startTime;}
Whenever you want to start your DeltaTime timer, you just do time = System.currentTimeMillis;
. This way, the variable "delta" is the amount of time between when you started the DeltaTime timer and when you end it using ClassNameHere.deltaTime();
.