The Battle for Wesnoth  1.19.6+dev
Namespaces | Typedefs | Functions
chrono Namespace Reference

Namespaces

 format
 Helper types to be used with deconstruct_duration.
 

Typedefs

using days = std::chrono::duration< int, std::ratio< 86400 > >
 
using weeks = std::chrono::duration< int, std::ratio< 604800 > >
 
using months = std::chrono::duration< int, std::ratio< 2629746 > >
 
using years = std::chrono::duration< int, std::ratio< 31556952 > >
 

Functions

auto parse_timestamp (long long val)
 
auto parse_timestamp (const config_attribute_value &val)
 
auto serialize_timestamp (const std::chrono::system_clock::time_point &time)
 
auto format_local_timestamp (const std::chrono::system_clock::time_point &time, std::string_view format="%F %T")
 
template<typename Duration >
auto parse_duration (const config_attribute_value &val, const Duration &def=Duration{0})
 
template<typename... Ts, typename Rep , typename Period >
constexpr auto deconstruct_duration (const std::tuple< Ts... > &, const std::chrono::duration< Rep, Period > &span)
 

Typedef Documentation

◆ days

using chrono::days = typedef std::chrono::duration<int, std::ratio<86400> >

Definition at line 39 of file chrono.hpp.

◆ months

using chrono::months = typedef std::chrono::duration<int, std::ratio<2629746> >

Definition at line 41 of file chrono.hpp.

◆ weeks

using chrono::weeks = typedef std::chrono::duration<int, std::ratio<604800> >

Definition at line 40 of file chrono.hpp.

◆ years

using chrono::years = typedef std::chrono::duration<int, std::ratio<31556952> >

Definition at line 42 of file chrono.hpp.

Function Documentation

◆ deconstruct_duration()

template<typename... Ts, typename Rep , typename Period >
constexpr auto chrono::deconstruct_duration ( const std::tuple< Ts... > &  ,
const std::chrono::duration< Rep, Period > &  span 
)
constexpr

Definition at line 76 of file chrono.hpp.

Referenced by utils::format_timespan(), and wesnothd::player_status().

◆ format_local_timestamp()

auto chrono::format_local_timestamp ( const std::chrono::system_clock::time_point &  time,
std::string_view  format = "%F %T" 
)
inline

◆ parse_duration()

template<typename Duration >
auto chrono::parse_duration ( const config_attribute_value val,
const Duration &  def = Duration{0} 
)
inline

◆ parse_timestamp() [1/2]

auto chrono::parse_timestamp ( const config_attribute_value val)
inline

Definition at line 51 of file chrono.hpp.

References config_attribute_value::to_long_long().

◆ parse_timestamp() [2/2]

auto chrono::parse_timestamp ( long long  val)
inline

◆ serialize_timestamp()

auto chrono::serialize_timestamp ( const std::chrono::system_clock::time_point &  time)
inline