diff --git a/src/config/ConfigGlobal.hxx b/src/config/ConfigGlobal.hxx index ca846be27..2b6bb7ea3 100644 --- a/src/config/ConfigGlobal.hxx +++ b/src/config/ConfigGlobal.hxx @@ -23,6 +23,8 @@ #include "ConfigOption.hxx" #include "Compiler.h" +#include + 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);