druidengine/druid
Voir sur GitHubImplement Duration module to provide time conversion utility functions.
Open
#41 ouverte le 15 oct. 2025
enhancementgood first issue
Métriques du dépôt
- Stars
- (3 stars)
- Métriques de merge PR
- (Métriques PR en attente)
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<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.