RSTools 3.1.0
Versatile C++20 utility library
Loading...
Searching...
No Matches
RST::Time Namespace Reference

Stopwatch, frame timing and date formatting. More...

Classes

class  FrameTimer
 Measures the frames of a game or render loop, and can cap the frame rate. More...
 
class  Timer
 Stopwatch that can be stopped and resumed, based on a steady clock. More...
 

Enumerations

enum class  TimeZone : std::uint8_t { Local , Utc }
 Time zone used to format dates. More...
 

Functions

std::string formatTime (std::chrono::system_clock::time_point time, std::string_view format="%Y-%m-%d %H:%M:%S", TimeZone zone=TimeZone::Local)
 Formats time with std::strftime codes, such as Y-m-d H:M:S; returns an empty string on failure.
 
std::string formatNow (std::string_view format="%Y-%m-%d %H:%M:%S", TimeZone zone=TimeZone::Local)
 Formats the current time; see formatTime().
 

Detailed Description

Stopwatch, frame timing and date formatting.

Enumeration Type Documentation

◆ TimeZone

enum class RST::Time::TimeZone : std::uint8_t
strong

Time zone used to format dates.

Enumerator
Local 
Utc 

Function Documentation

◆ formatTime()

std::string RST::Time::formatTime ( std::chrono::system_clock::time_point  time,
std::string_view  format = "%Y-%m-%d %H:%M:%S",
TimeZone  zone = TimeZone::Local 
)

Formats time with std::strftime codes, such as Y-m-d H:M:S; returns an empty string on failure.

◆ formatNow()

std::string RST::Time::formatNow ( std::string_view  format = "%Y-%m-%d %H:%M:%S",
TimeZone  zone = TimeZone::Local 
)

Formats the current time; see formatTime().

Examples
system.cpp.