DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
discord_core_api::time_stamp_base< value_type > Class Template Reference

A base class for handling time stamps and conversions. More...

#include <Base.hpp>

Public Member Functions

bool hasTimeElapsed (int64_t days, int64_t hours, int64_t minutes) const
 Checks if a certain time duration has elapsed. More...
 
bool operator== (jsonifier::string_view other) const
 Checks if the time stamp is equal to a string representation. More...
 

Static Public Member Functions

static jsonifier::string convertMsToDurationString (uint64_t durationInMs)
 Converts milliseconds into a human-readable duration string. More...
 
static jsonifier::string convertToCurrentISO8601TimeStamp (time_format timeFormat)
 Converts the current time into an iso8601 time stamp. More...
 
static jsonifier::string convertToFutureISO8601TimeStamp (uint64_t minutesToAdd, uint64_t hoursToAdd, uint64_t daysToAdd, uint64_t monthsToAdd, uint64_t yearsToAdd, time_format timeFormat)
 Converts given time values into a future iso8601 time stamp. More...
 
static jsonifier::string getISO8601TimeStamp (time_format timeFormat, uint64_t inputTime)
 Gets an iso8601 time stamp string based on the provided time format. More...
 
static uint64_t getTimeSinceEpoch (uint64_t year, uint64_t month, uint64_t day, uint64_t hour, uint64_t minute, uint64_t second)
 Gets the time since the unix epoch for the specified date and time. More...
 

Member Function Documentation

◆ convertMsToDurationString()

template<typename value_type >
static jsonifier::string discord_core_api::time_stamp_base< value_type >::convertMsToDurationString ( uint64_t  durationInMs)
inlinestatic
Parameters
durationInMsduration in milliseconds to convert.
Returns
human-readable duration string.

Definition at line 431 of file Base.hpp.

◆ convertStringToUintTimeStamp()

template<typename value_type >
uint64_t discord_core_api::time_stamp_base< value_type >::convertStringToUintTimeStamp ( jsonifier::string_view  stringTimeStamp) const
inlineprotected
Parameters
stringTimeStampstring time stamp to convert.
Returns
converted time value in milliseconds.

Definition at line 605 of file Base.hpp.

Here is the call graph for this function:

◆ convertTimeStampToTimeUnits()

template<typename value_type >
static uint64_t discord_core_api::time_stamp_base< value_type >::convertTimeStampToTimeUnits ( jsonifier::string_view  originalTimeStamp)
inlinestaticprotected
Parameters
originalTimeStamporiginal time stamp string.
Returns
converted time value in milliseconds.

Definition at line 590 of file Base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convertToCurrentISO8601TimeStamp()

template<typename value_type >
static jsonifier::string discord_core_api::time_stamp_base< value_type >::convertToCurrentISO8601TimeStamp ( time_format  timeFormat)
inlinestatic
Parameters
timeFormatformat for the resulting time stamp.
Returns
iso8601 time stamp string.

Definition at line 376 of file Base.hpp.

Here is the call graph for this function:

◆ convertToFutureISO8601TimeStamp()

template<typename value_type >
static jsonifier::string discord_core_api::time_stamp_base< value_type >::convertToFutureISO8601TimeStamp ( uint64_t  minutesToAdd,
uint64_t  hoursToAdd,
uint64_t  daysToAdd,
uint64_t  monthsToAdd,
uint64_t  yearsToAdd,
time_format  timeFormat 
)
inlinestatic
Parameters
minutesToAddnumber of minutes to add.
hoursToAddnumber of hours to add.
daysToAddnumber of days to add.
monthsToAddnumber of months to add.
yearsToAddnumber of years to add.
timeFormatformat for the resulting time stamp.
Returns
iso8601 time stamp string.

Definition at line 334 of file Base.hpp.

Here is the call graph for this function:

◆ convertUintToStringTimeStamp()

template<typename value_type >
jsonifier::string discord_core_api::time_stamp_base< value_type >::convertUintToStringTimeStamp ( uint64_t  uintTimeStamp) const
inlineprotected
Parameters
uintTimeStamptime value to convert.
Returns
string time stamp.

Definition at line 612 of file Base.hpp.

Here is the call graph for this function:

◆ getISO8601TimeStamp()

template<typename value_type >
static jsonifier::string discord_core_api::time_stamp_base< value_type >::getISO8601TimeStamp ( time_format  timeFormat,
uint64_t  inputTime 
)
inlinestatic
Parameters
timeFormatformat for the resulting time stamp.
inputTimeinput time value.
Returns
iso8601 time stamp string.

Definition at line 458 of file Base.hpp.

Here is the caller graph for this function:

◆ getTimeSinceEpoch()

template<typename value_type >
static uint64_t discord_core_api::time_stamp_base< value_type >::getTimeSinceEpoch ( uint64_t  year,
uint64_t  month,
uint64_t  day,
uint64_t  hour,
uint64_t  minute,
uint64_t  second 
)
inlinestatic
Parameters
yearyear.
monthmonth.
dayday.
hourhour.
minuteminute.
secondsecond.
Returns
time since unix epoch in milliseconds.

Definition at line 510 of file Base.hpp.

Here is the caller graph for this function:

◆ hasTimeElapsed()

template<typename value_type >
bool discord_core_api::time_stamp_base< value_type >::hasTimeElapsed ( int64_t  days,
int64_t  hours,
int64_t  minutes 
) const
inline
Parameters
daysnumber of days for elapsed time.
hoursnumber of hours for elapsed time.
minutesnumber of minutes for elapsed time.
Returns
true if the specified time has elapsed, otherwise false.

Definition at line 407 of file Base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator==()

template<typename value_type >
bool discord_core_api::time_stamp_base< value_type >::operator== ( jsonifier::string_view  other) const
inline
Parameters
otherthe string to compare with.
Returns
true if equal, false otherwise.

Definition at line 322 of file Base.hpp.


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