BoosterSeat  0.1
A C++ library that includes common utilities that are used in other projects.
bst::time Namespace Reference

Enumerations

enum class  TimeZone { UTC , LOCAL }
 

Functions

std::string dateAndTimeString (const bst::clck::TimePoint &time_point)
 
std::string dateAndTimeString (TimeZone time_zone=TimeZone::LOCAL, char date_delimiter='-', char between_delimiter=' ', char time_delimiter=':', bst::clck::TimePoint time_point=bst::clck::now())
 Get the date and time in the format: YYYY-MM-DD HH:MM:SS. More...
 
bst::clck::TimePoint dateAndTimeToTimePoint (int year, int month, int day, int hour, int minute, int second)
 Convert a date and time to a bst::clck::TimePoint. More...
 
std::string dateString (TimeZone time_zone=TimeZone::LOCAL, char delimiter='-')
 
std::string elapsedAsciiClock (const bst::clck::TimePoint &time_point)
 
std::string timeString (TimeZone time_zone=TimeZone::LOCAL, char delimiter=':', bst::clck::TimePoint time_point=bst::clck::now())
 Get the time in format: HH:MM:SS (24 hour clock) for a given time zone. More...
 

Detailed Description

Deprecated:
The time namespace will be removed in the future.

Enumeration Type Documentation

◆ TimeZone

enum bst::time::TimeZone
strong
Enumerator
UTC 
LOCAL 

Function Documentation

◆ elapsedAsciiClock()

std::string bst::time::elapsedAsciiClock ( const bst::clck::TimePoint time_point)

References bst::clck::secondsElapsed().

Referenced by main().

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

◆ timeString()

std::string bst::time::timeString ( TimeZone  time_zone = TimeZone::LOCAL,
char  delimiter = ':',
bst::clck::TimePoint  time_point = bst::clck::now() 
)

Get the time in format: HH:MM:SS (24 hour clock) for a given time zone.

Parameters
time_zone- The time zone to get the time in
delimiter- The delimiter to use (default: ':')
time- The time to get the string for (default: current time)
Returns
std::string - The time string

References getTm(), timeFormatString(), and bst::clck::toTimeT().

Referenced by main().

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

◆ dateString()

std::string bst::time::dateString ( TimeZone  time_zone = TimeZone::LOCAL,
char  delimiter = '-' 
)

References dateFormatString(), and getTm().

Referenced by main().

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

◆ dateAndTimeString() [1/2]

std::string bst::time::dateAndTimeString ( TimeZone  time_zone = TimeZone::LOCAL,
char  date_delimiter = '-',
char  between_delimiter = ' ',
char  time_delimiter = ':',
bst::clck::TimePoint  time_point = bst::clck::now() 
)

Get the date and time in the format: YYYY-MM-DD HH:MM:SS.

Returns
std::string

References dateFormatString(), getTm(), timeFormatString(), and bst::clck::toTimeT().

Referenced by dateAndTimeString(), and main().

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

◆ dateAndTimeString() [2/2]

std::string bst::time::dateAndTimeString ( const bst::clck::TimePoint time_point)
inline

References dateAndTimeString(), and LOCAL.

Here is the call graph for this function:

◆ dateAndTimeToTimePoint()

bst::clck::TimePoint bst::time::dateAndTimeToTimePoint ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second 
)

Convert a date and time to a bst::clck::TimePoint.

All parameters are clamped to their respective ranges.

Parameters
year- The year (e.g. 2023, must be greater than 1970)
month- The month (1 - 12)
day- The day (1 - 31)
hour- The hour (0 - 23)
minute- The minute (0 - 59)
second- The second (0 - 59)
Returns
bst::clck::TimePoint - The time point

References bst::clck::fromTimeT(), and bst::TIME_INVALID_TIME.

Referenced by main().

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