wex v24.10.0
Public Types | Public Member Functions | Static Public Attributes | List of all members
wex::chrono Class Reference

Offers a chrono class. More...

#include <wex/core/chrono.h>

Public Types

enum class  precision_t { SEC , MILLI , MICRO , NANO }
 Precision used for outputting time. More...
 

Public Member Functions

 chrono (const std::string &format=TIME_FORMAT, precision_t precision=precision_t::SEC)
 Default constructor.
 
std::string get_time (time_t tt) const
 Returns time string for a time_t. Precision is not used.
 
std::string get_time (const timespec &ts) const
 Returns time string for a timespec, using precision.
 
std::string get_time (const std::chrono::time_point< std::chrono::system_clock > &tp) const
 Returns time string for a time_point, using precision.
 
std::optional< time_t > get_time (const std::string &time) const
 Returns time_t for a time string.
 

Static Public Attributes

static const std::string TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
 The default time format.
 

Detailed Description

Offers a chrono class.

Member Enumeration Documentation

◆ precision_t

enum class wex::chrono::precision_t
strong

Precision used for outputting time.

Enumerator
SEC 

seconds

MILLI 

millisecond

MICRO 

microsecond

NANO 

nanosecond