config/Global: add std::chrono::steady_clock::duration overload
This commit is contained in:
parent
018c5ef731
commit
3413d1bf23
|
@ -23,6 +23,8 @@
|
|||
#include "ConfigOption.hxx"
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
class Path;
|
||||
class AllocatedPath;
|
||||
struct ConfigParam;
|
||||
|
@ -88,10 +90,30 @@ gcc_pure
|
|||
unsigned
|
||||
config_get_unsigned(enum ConfigOption option, unsigned default_value);
|
||||
|
||||
gcc_pure
|
||||
static inline std::chrono::steady_clock::duration
|
||||
config_get_unsigned(ConfigOption option,
|
||||
std::chrono::steady_clock::duration default_value)
|
||||
{
|
||||
// TODO: allow unit suffixes
|
||||
auto u = config_get_unsigned(option, default_value.count());
|
||||
return std::chrono::steady_clock::duration(u);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
unsigned
|
||||
config_get_positive(enum ConfigOption option, unsigned default_value);
|
||||
|
||||
gcc_pure
|
||||
static inline std::chrono::steady_clock::duration
|
||||
config_get_positive(ConfigOption option,
|
||||
std::chrono::steady_clock::duration default_value)
|
||||
{
|
||||
// TODO: allow unit suffixes
|
||||
auto u = config_get_positive(option, default_value.count());
|
||||
return std::chrono::steady_clock::duration(u);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
bool config_get_bool(enum ConfigOption option, bool default_value);
|
||||
|
||||
|
|
Loading…
Reference in New Issue