libecs-cpp 2.1.0
Entity Component System library in C++
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ecs::Clock Class Referenceabstract

A source of time for systems and containers. More...

#include <Clock.hpp>

Inheritance diagram for ecs::Clock:
Inheritance graph
[legend]

Public Member Functions

virtual ~Clock ()=default
 Destroys the clock.
 
virtual std::chrono::microseconds Now () const =0
 Time since the clock's starting point, in microseconds.
 

Detailed Description

A source of time for systems and containers.

Now() returns the time since some fixed starting point that the clock chooses. It never decreases. Only differences between two readings of the same clock mean anything.

A system or a container holds a pointer to its clock and does not own it, so the clock must outlive whatever uses it. The default is the real steady clock (SteadyClock). A ManualClock lets a test move time by exact amounts without waiting.

Constructor & Destructor Documentation

◆ ~Clock()

virtual ecs::Clock::~Clock ( )
virtualdefault

Destroys the clock.

Member Function Documentation

◆ Now()

virtual std::chrono::microseconds ecs::Clock::Now ( ) const
pure virtual

Time since the clock's starting point, in microseconds.

Never decreases.

Implemented in ecs::SteadyClock, and ecs::ManualClock.


The documentation for this class was generated from the following file: