Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::TimeSpan Class Reference

Time Interval Class. More...

#include <TimeSpan.h>

Public Member Functions

 TimeSpan (int32_t days, int32_t hours, int32_t minutes, int32_t seconds, int32_t milliseconds, int32_t microseconds) noexcept
 
 TimeSpan (uint64_t timestamp) noexcept
 
int32_t getDays () const noexcept
 
int32_t getHours () const noexcept
 
int32_t getMinutes () const noexcept
 
int32_t getSeconds () const noexcept
 
int32_t getMilliseconds () const noexcept
 
int32_t getMicroseconds () const noexcept
 
double getTotalDays () const noexcept
 
double getTotalHours () const noexcept
 
double getTotalMinutes () const noexcept
 
double getTotalSeconds () const noexcept
 
double getTotalMilliseconds () const noexcept
 
uint64_t getTotalMicroseconds () const noexcept
 
uint64_t getTimestamp () const noexcept
 

Static Public Attributes

static const TimeSpan ZERO = sese::TimeSpan(0, 0, 0, 0, 0, 0)
 Zero time interval.
 

Private Attributes

uint64_t timestamp = 0
 Timestamp in microseconds.
 

Detailed Description

Time Interval Class.

Constructor & Destructor Documentation

◆ TimeSpan() [1/2]

sese::TimeSpan::TimeSpan ( int32_t days,
int32_t hours,
int32_t minutes,
int32_t seconds,
int32_t milliseconds,
int32_t microseconds )
noexcept

◆ TimeSpan() [2/2]

sese::TimeSpan::TimeSpan ( uint64_t timestamp)
explicitnoexcept

Member Function Documentation

◆ getDays()

int32_t sese::TimeSpan::getDays ( ) const
nodiscardnoexcept

Get the number of days represented by the current structure

Returns
Number of days

References timestamp.

◆ getHours()

int32_t sese::TimeSpan::getHours ( ) const
nodiscardnoexcept

Get the number of hours represented by the current structure

Returns
Number of hours

◆ getMicroseconds()

int32_t sese::TimeSpan::getMicroseconds ( ) const
nodiscardnoexcept

Get the number of microseconds represented by the current structure

Returns
Number of microseconds

◆ getMilliseconds()

int32_t sese::TimeSpan::getMilliseconds ( ) const
nodiscardnoexcept

Get the number of milliseconds represented by the current structure

Returns
Number of milliseconds

◆ getMinutes()

int32_t sese::TimeSpan::getMinutes ( ) const
nodiscardnoexcept

Get the number of minutes represented by the current structure

Returns
Number of minutes

◆ getSeconds()

int32_t sese::TimeSpan::getSeconds ( ) const
nodiscardnoexcept

Get the number of seconds represented by the current structure

Returns
Number of seconds

◆ getTimestamp()

uint64_t sese::TimeSpan::getTimestamp ( ) const
inlinenodiscardnoexcept

Get the timestamp with microseconds as the unit of time

Returns
Timestamp

References timestamp.

◆ getTotalDays()

double sese::TimeSpan::getTotalDays ( ) const
nodiscardnoexcept

Get the total number of days represented by the current structure

Returns
Total number of days

◆ getTotalHours()

double sese::TimeSpan::getTotalHours ( ) const
nodiscardnoexcept

Get the total number of hours represented by the current structure

Returns
Total number of hours

◆ getTotalMicroseconds()

uint64_t sese::TimeSpan::getTotalMicroseconds ( ) const
nodiscardnoexcept

Get the total number of microseconds represented by the current structure

Returns
Total number of microseconds

◆ getTotalMilliseconds()

double sese::TimeSpan::getTotalMilliseconds ( ) const
nodiscardnoexcept

Get the total number of milliseconds represented by the current structure

Returns
Total number of milliseconds

◆ getTotalMinutes()

double sese::TimeSpan::getTotalMinutes ( ) const
nodiscardnoexcept

Get the total number of minutes represented by the current structure

Returns
Total number of minutes

◆ getTotalSeconds()

double sese::TimeSpan::getTotalSeconds ( ) const
nodiscardnoexcept

Get the total number of seconds represented by the current structure

Returns
Total number of seconds

Member Data Documentation

◆ timestamp

uint64_t sese::TimeSpan::timestamp = 0
private

Timestamp in microseconds.

Referenced by getDays(), getTimestamp(), and sese::DateTime::operator-().

◆ ZERO

const sese::TimeSpan sese::TimeSpan::ZERO = sese::TimeSpan(0, 0, 0, 0, 0, 0)
static

Zero time interval.


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