Commit 3413d1bf authored by Max Kellermann's avatar Max Kellermann

config/Global: add std::chrono::steady_clock::duration overload

parent 018c5ef7
......@@ -23,6 +23,8 @@
#include "ConfigOption.hxx"
#include "Compiler.h"
#include <chrono>
class Path;
class AllocatedPath;
struct ConfigParam;
......@@ -89,10 +91,30 @@ 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);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment