druidengine/druid
Auf GitHub ansehenImplement Duration module to provide time conversion utility functions.
Open
#41 geöffnet am 15. Okt. 2025
enhancementgood first issue
Repository-Metriken
- Stars
- (3 Stars)
- PR-Merge-Metriken
- (PR-Metriken ausstehend)
Beschreibung
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<double>asdruid::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.