GlobalTime ClassDelta Engine Documentation
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

System Object
  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

public abstract class GlobalTime : IDisposable

The GlobalTime type exposes the following members.

Constructors

  NameDescription
Protected methodGlobalTime
Initializes a new instance of the GlobalTime class
Top
Methods

  NameDescription
Public methodDispose
Releases all resources used by the GlobalTime
Public methodGetSecondsSinceStartToday
Returns an accurate seconds float value for today, would get inaccurate with more days. View code on GitHub
Protected methodGetTicks
Public methodUpdate
Top
Properties

  NameDescription
Public propertyStatic memberCurrent
StopwatchTime by default, easy to change (tests use MockTime, resolvers restart time). View code on GitHub
Public propertyFps
Public propertyMilliseconds
Protected propertyTicksPerSecond
Top
Remarks

Tests: DeltaEngine.Tests.Core.GlobalTimeTests
Examples

6 unit tests call DeltaEngine.Core.GlobalTime
[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