D++ (DPP)
C++ Discord API Bot Library
dpp::utility::uptime Struct Reference

A class used to represent an uptime in hours, minutes, seconds and days, with helper functions to convert from time_t and display as a string. More...

#include <utility.h>

+ Collaboration diagram for dpp::utility::uptime:

Public Member Functions

 uptime ()
 Construct a new uptime object. More...
 
 uptime (time_t diff)
 Construct a new uptime object. More...
 
 uptime (double diff)
 Construct a new uptime object. More...
 
std::string to_string () const
 Get uptime as string. More...
 
uint64_t to_secs () const
 Get uptime as seconds. More...
 
uint64_t to_msecs () const
 Get uptime as milliseconds. More...
 

Public Attributes

uint16_t days
 Number of days. More...
 
uint8_t hours
 Number of hours. More...
 
uint8_t mins
 Number of minutes. More...
 
uint8_t secs
 Number of seconds. More...
 

Detailed Description

A class used to represent an uptime in hours, minutes, seconds and days, with helper functions to convert from time_t and display as a string.

Constructor & Destructor Documentation

◆ uptime() [1/3]

dpp::utility::uptime::uptime ( )

Construct a new uptime object.

◆ uptime() [2/3]

dpp::utility::uptime::uptime ( time_t  diff)

Construct a new uptime object.

Parameters
diffA time_t to initialise the object from

◆ uptime() [3/3]

dpp::utility::uptime::uptime ( double  diff)

Construct a new uptime object.

Parameters
diffA time_t to initialise the object from

Member Function Documentation

◆ to_msecs()

uint64_t dpp::utility::uptime::to_msecs ( ) const

Get uptime as milliseconds.

Returns
uint64_t Uptime as milliseconds

◆ to_secs()

uint64_t dpp::utility::uptime::to_secs ( ) const

Get uptime as seconds.

Returns
uint64_t Uptime as seconds

◆ to_string()

std::string dpp::utility::uptime::to_string ( ) const

Get uptime as string.

Returns
std::string Uptime as string

Member Data Documentation

◆ days

uint16_t dpp::utility::uptime::days

Number of days.

◆ hours

uint8_t dpp::utility::uptime::hours

Number of hours.

◆ mins

uint8_t dpp::utility::uptime::mins

Number of minutes.

◆ secs

uint8_t dpp::utility::uptime::secs

Number of seconds.

D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0