ge211  2021.5.1
A student game engine
Timer Class Reference

Detailed Description

A class for timing intervals. The result is a Duration.

Definition at line 267 of file ge211_time.hxx.

Public Member Functions

 Timer ()
 Creates a new timer, running from the time it was created.
 
Duration reset ()
 Resets a timer, returning the time it was at before it was reset.
 
Time_point start_time () const
 Returns the actual time when this timer was started or most recently reset.
 
Duration elapsed_time () const
 Returns how much time has elapsed since this timer was started or most recently reset.
 

Static Public Member Functions

static Timer future (Duration duration)
 Creates a timer whose “start time” is some Duration in the future. More...
 

Member Function Documentation

◆ future()

static Timer future ( Duration  duration)
inlinestatic

Creates a timer whose “start time” is some Duration in the future.

Suppose we want to wait 30 seconds and then do something. We could create a Timer whose “start time” is in 30 seconds, and then poll it on each frame. When it returns a non-negative number for its elapsed_time() const, we know that the time as arrived.

Definition at line 278 of file ge211_time.hxx.


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