MXS-2329 Make duration misuse harder

Now the desired type must be specified when getting a duration.
The type also dictates how durations without suffixes should be
interpreted.

That removes the need for remembering that to convert a returned
millisecond duration to a second duration.
This commit is contained in:
Johan Wikman
2019-04-29 10:00:44 +03:00
parent 8bf0e00b1c
commit 8a250a8b13
4 changed files with 43 additions and 10 deletions

View File

@ -1947,8 +1947,9 @@ uint64_t MXS_CONFIG_PARAMETER::get_size(const std::string& key) const
return intval;
}
std::chrono::milliseconds MXS_CONFIG_PARAMETER::get_duration(const std::string& key,
mxs::config::DurationInterpretation interpretation)
std::chrono::milliseconds
MXS_CONFIG_PARAMETER::get_duration_in_ms(const std::string& key,
mxs::config::DurationInterpretation interpretation)
const
{
string value = get_string(key);