| ▲ | layer8 15 hours ago | ||||||||||||||||||||||||||||||||||
Or require the value to specify a unit. | |||||||||||||||||||||||||||||||||||
| ▲ | mort96 14 hours ago | parent [-] | ||||||||||||||||||||||||||||||||||
At that point, you're making all your configuration fields strings and adding another parsing step after the json/toml/yaml parser is done with it. That's not ideal either; either you write a bunch of parsing code (not terribly difficult but not something I wanna do when I can just not), or you use some time library to parse a duration string, in which case the programming language and time library you happen to use suddenly becomes part of your config file specification and you have to exactly re-implement your old time handling library's duration parser if you ever want to switch to a new one or re-implement the tool in another language. I don't think there are great solutions here. Arguably, units should be supported by the config file format, but existing config file formats don't do that. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||