config/Data: cast to std::chrono::steady_clock::duration properly
Oh no, 3413d1bf23
was broken! Instead of passing a number as
"seconds" to the duration constructor, it just abused the duration
constructor as cast operator, which caused custom state_file_interval
settings to be extremely short.
This commit is contained in:
@@ -135,3 +135,11 @@ ParseSize(const char *s, std::size_t default_factor)
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
std::chrono::steady_clock::duration
|
||||
ParseDuration(const char *s)
|
||||
{
|
||||
// TODO: allow unit suffixes
|
||||
const std::chrono::seconds seconds(ParseLong(s));
|
||||
return std::chrono::duration_cast<std::chrono::steady_clock::duration>(seconds);
|
||||
}
|
||||
|
Reference in New Issue
Block a user