Use nanoseconds for ticks

pull/12/head
Caroline Bell 2020-03-02 13:36:36 -08:00
parent e3661b5fb7
commit 610e52b633
1 changed files with 2 additions and 2 deletions

View File

@ -50,10 +50,10 @@ public class Timer extends GingerThread
public boolean tick() public boolean tick()
{ {
long currentTime = System.currentTimeMillis(); long currentTime = System.nanoTime();
if (currentTime >= nextTick) if (currentTime >= nextTick)
{ {
long targetTimeDelta = 1000L / tickRate; long targetTimeDelta = 1000000000L / tickRate;
if (lastTick == 0 || nextTick == 0) if (lastTick == 0 || nextTick == 0)
{ {
lastTick = currentTime - targetTimeDelta; lastTick = currentTime - targetTimeDelta;