Use nanoseconds for ticks
parent
e3661b5fb7
commit
610e52b633
|
@ -50,10 +50,10 @@ public class Timer extends GingerThread
|
|||
|
||||
public boolean tick()
|
||||
{
|
||||
long currentTime = System.currentTimeMillis();
|
||||
long currentTime = System.nanoTime();
|
||||
if (currentTime >= nextTick)
|
||||
{
|
||||
long targetTimeDelta = 1000L / tickRate;
|
||||
long targetTimeDelta = 1000000000L / tickRate;
|
||||
if (lastTick == 0 || nextTick == 0)
|
||||
{
|
||||
lastTick = currentTime - targetTimeDelta;
|
||||
|
|
Loading…
Reference in New Issue