druidengine / druidengine/druid
Implement Duration module to provide time conversion utility functions.
- Dominant language
- C++
- Stars
- 3
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
Current time conversion using chrono is verbose. Also, time as a double isn't supported out of the box.
**Describe the solution you'd like**
- [ ] Define `std::chrono::duration` as `druid::core::seconds`
- [ ] Implement functions to convert a `std::chrono::stead_clock::duration`:
- [ ] `druid::core::to_seconds() -> seconds`
- [ ] `druid::core::to_milliseconds() -> std::chrono::milliseconds`
- [ ] `druid::core::to_microseconds() -> std::chrono::microseconds`
- [ ] `druid::core::to_nanoseconds() -> std::chrono::nanoseconds`
- [ ] Implement appropriate tests in `Duration.test.cpp`
**Describe alternatives you've considered**
I considered making this a class `Duration` with methods for the conversion but I think this a little nicer to maintain.
**Additional context**
This is really needed for the `seconds` type we'll get from this. Most math / physics work off of fractional seconds.
Contributor guide
Assessment
This issue has not been assessed yet.