cat3d
A tiny OpenGL 3D engine library written in and for C++.
Public Member Functions | Static Public Member Functions | List of all members
cat3d::util::time Class Reference

Class representing a duration of time. More...

#include <clock.hpp>

Public Member Functions

 time ()
 By default, initializes to length 0.
 
float as_seconds () const
 Convert this time duration into seconds. More...
 
unsigned long as_milliseconds () const
 Convert this time duration into milliseconds. More...
 
float as_minutes () const
 Convert this time duration into minutes. More...
 
time operator+ (const time &other)
 Add two times together.
 
time operator- (const time &other)
 Subtract two time durations.
 
timeoperator+= (const time &other)
 Add one duration to this.
 
timeoperator-= (const time &other)
 Subtract a duration of time from this.
 
bool operator> (const time &other)
 Check if one duration is larger than another.
 
bool operator< (const time &other)
 Check if one duration is smaller than another.
 
bool operator>= (const time &other)
 Check if one duration is greater than or equal to another.
 
bool operator<= (const time &other)
 Check if one duration is smaller than or equal to another.
 
bool operator== (const time &other)
 Check if two durations are exactly equal.
 
bool operator!= (const time &other)
 Check if two durations aren't exactly equal.
 

Static Public Member Functions

static time seconds (float s)
 Create a new time duration given seconds. More...
 
static time milliseconds (unsigned long ms)
 Create a new time duration, given milliseconds. More...
 
static time minutes (float m)
 Create a new time duration, given minutes. More...
 

Detailed Description

Class representing a duration of time.

Member Function Documentation

◆ as_milliseconds()

unsigned long cat3d::util::time::as_milliseconds ( ) const

Convert this time duration into milliseconds.

Returns
unsigned long

◆ as_minutes()

float cat3d::util::time::as_minutes ( ) const

Convert this time duration into minutes.

Returns
float

◆ as_seconds()

float cat3d::util::time::as_seconds ( ) const

Convert this time duration into seconds.

Returns
float

◆ milliseconds()

static time cat3d::util::time::milliseconds ( unsigned long  ms)
static

Create a new time duration, given milliseconds.

Parameters
ms
Returns
time

◆ minutes()

static time cat3d::util::time::minutes ( float  m)
static

Create a new time duration, given minutes.

Parameters
m
Returns
time

◆ seconds()

static time cat3d::util::time::seconds ( float  s)
static

Create a new time duration given seconds.

Parameters
s
Returns
time

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