aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Timer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.Client/Timer.cpp')
-rw-r--r--Minecraft.Client/Timer.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Minecraft.Client/Timer.cpp b/Minecraft.Client/Timer.cpp
index b451c034..15a2c2f1 100644
--- a/Minecraft.Client/Timer.cpp
+++ b/Minecraft.Client/Timer.cpp
@@ -22,8 +22,9 @@ void Timer::advanceTime()
{
__int64 nowMs = System::currentTimeMillis();
__int64 passedMs = nowMs - lastMs;
- __int64 msSysTime = System::nanoTime() / 1000000;
- double now = msSysTime / 1000.0;
+
+ // 4J - Use high-resolution timer for 'now' in seconds
+ double now = System::nanoTime() / 1000000000.0;
if (passedMs > 1000)
@@ -39,6 +40,7 @@ void Timer::advanceTime()
accumMs += passedMs;
if (accumMs > 1000)
{
+ __int64 msSysTime = (__int64)(now * 1000.0);
__int64 passedMsSysTime = msSysTime - lastMsSysTime;
double adjustTimeT = accumMs / (double) passedMsSysTime;
@@ -49,7 +51,7 @@ void Timer::advanceTime()
}
if (accumMs < 0)
{
- lastMsSysTime = msSysTime;
+ lastMsSysTime = (__int64)(now * 1000.0);
}
}
lastMs = nowMs;
@@ -68,7 +70,6 @@ void Timer::advanceTime()
if (ticks > MAX_TICKS_PER_UPDATE) ticks = MAX_TICKS_PER_UPDATE;
a = passedTime;
-
}
void Timer::advanceTimeQuickly()