From 610e52b633655c557f1286cacbf208fedff412aa Mon Sep 17 00:00:00 2001 From: halotroop2288 Date: Mon, 2 Mar 2020 13:36:36 -0800 Subject: [PATCH] Use nanoseconds for ticks --- src/main/java/com/github/halotroop/litecraft/logic/Timer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/halotroop/litecraft/logic/Timer.java b/src/main/java/com/github/halotroop/litecraft/logic/Timer.java index 317ccae..74847c9 100644 --- a/src/main/java/com/github/halotroop/litecraft/logic/Timer.java +++ b/src/main/java/com/github/halotroop/litecraft/logic/Timer.java @@ -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;