TimeDelta java?

后端 未结 3 1148
孤独总比滥情好
孤独总比滥情好 2021-01-26 08:47

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):
         


        
3条回答
  •  一整个雨季
    2021-01-26 09:10

    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();.

提交回复
热议问题