glibmm 2.80.0
Public Member Functions | List of all members
Glib::Timer Class Reference

Portable stop watch interface. More...

#include <glibmm/timer.h>

Public Member Functions

 Timer ()
 Create a new timer.
 
 ~Timer () noexcept
 
 Timer (const Timer &)=delete
 
Timeroperator= (const Timer &)=delete
 
void start ()
 
void stop ()
 
void reset ()
 
void resume ()
 Resumes a timer that has previously been stopped with stop().
 
double elapsed () const
 Get the elapsed time.
 
double elapsed (unsigned long &microseconds) const
 Get the elapsed time.
 
bool is_active () const
 Exposes whether the timer is currently active.
 

Detailed Description

Portable stop watch interface.

This resembles a convenient and portable timer with microseconds resolution.

Constructor & Destructor Documentation

◆ Timer() [1/2]

Glib::Timer::Timer ( )

Create a new timer.

Also starts timing by calling start() implicitly.

◆ ~Timer()

Glib::Timer::~Timer ( )
noexcept

◆ Timer() [2/2]

Glib::Timer::Timer ( const Timer )
delete

Member Function Documentation

◆ elapsed() [1/2]

double Glib::Timer::elapsed ( ) const

Get the elapsed time.

Returns
The value in seconds.

◆ elapsed() [2/2]

double Glib::Timer::elapsed ( unsigned long microseconds) const

Get the elapsed time.

Returns
The value in seconds. Also fills microseconds with the corresponding µs value.

◆ is_active()

bool Glib::Timer::is_active ( ) const

Exposes whether the timer is currently active.

@newin{2,70]

Returns
true if the timer is running, false otherwise.

◆ operator=()

Timer & Glib::Timer::operator= ( const Timer )
delete

◆ reset()

void Glib::Timer::reset ( )

◆ resume()

void Glib::Timer::resume ( )

Resumes a timer that has previously been stopped with stop().

stop() must be called before using this function.

@newin{2,70]

◆ start()

void Glib::Timer::start ( )

◆ stop()

void Glib::Timer::stop ( )