refactor(core): use std::chrono::time_point and std::chrono::duration whenever possible instead of int or double
Description
Currently, when we deal with time (timestamps, ...) we usually convert the value of std::chrono::system_clock::now()
into an integer or double, downcasting it in the required unit. This is dangerous, as upcasting and downcasting usually truncates the values. Most of the time, we lose precision with not added value. Furthermore, std::chrono API often requires std::chrono::time_point or std::chrono::duration, so we often need to convert back to them.
Proposal
Always keep the std::chrono::time_point
from std::chrono::system_clock::now()
, duration should stay
std::chrono::duration` everywhere.
Functional specifications
Usually a refactor does not alter functional specifications, but if there is any change to the workflow, UX/UI design, screenshots, etc..., please describe it here
Technical specifications
Details of the implementation
Test plan
Describe how you will verify that the implementation fulfils the specifications