MCPcopy Create free account
hub / github.com/cuberite/cuberite / Execute

Method Execute

src/World.cpp:200–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198
199
200void cWorld::cTickThread::Execute(void)
201{
202 cTimer Timer;
203
204 const Int64 msPerTick = 50;
205 Int64 LastTime = Timer.GetNowTime();
206
207 Int64 TickDuration = 50;
208 while (!m_ShouldTerminate)
209 {
210 Int64 NowTime = Timer.GetNowTime();
211 float DeltaTime = (float)(NowTime - LastTime);
212 m_World.Tick(DeltaTime, (int)TickDuration);
213 TickDuration = Timer.GetNowTime() - NowTime;
214
215 if (TickDuration < msPerTick)
216 {
217 // Stretch tick time until it's at least msPerTick
218 cSleep::MilliSleep((unsigned int)(msPerTick - TickDuration));
219 }
220
221 LastTime = NowTime;
222 }
223}
224
225
226

Callers

nothing calls this directly

Calls 2

GetNowTimeMethod · 0.80
TickMethod · 0.45

Tested by

no test coverage detected