Provides total run time and delta time for the current frame in seconds. Only used for
profiling, debugging and fps display. All game logic uses Time.Delta, Time.CheckEvery, etc.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Core GlobalTime
DeltaEngine.Core StopwatchTime
DeltaEngine.Mocks MockGlobalTime
DeltaEngine.Platforms GLFW3Time
Namespace: DeltaEngine.Core
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The GlobalTime type exposes the following members.
Constructors
Name | Description | |
---|---|---|
GlobalTime | Initializes a new instance of the GlobalTime class |
Methods
Name | Description | |
---|---|---|
Dispose | Releases all resources used by the GlobalTime | |
GetSecondsSinceStartToday |
Returns an accurate seconds float value for today, would get inaccurate with more days.
View code on GitHub | |
GetTicks | ||
Update |
Properties
Name | Description | |
---|---|---|
Current |
StopwatchTime by default, easy to change (tests use MockTime, resolvers restart time).
View code on GitHub | |
Fps | ||
Milliseconds | ||
TicksPerSecond |
Remarks
Examples
[Test] public void RunTime() { time.Update(); Assert.LessOrEqual(time.Milliseconds, 50); }
[Test] public void RunTimeWithStopwatch() { time = new StopwatchTime(); time.Update(); Assert.IsTrue(time.Milliseconds < 2, "Milliseconds=" + time.Milliseconds); }
[Test] public void CalculateFps() { do time.Update(); while (time.Milliseconds <= 1000); Assert.IsTrue(Math.Abs(time.Fps - 20) <= 1, "Fps=" + time.Fps); }
See Also