From 3539cb11977a91a6c4670f2db77cd8dc2ca970ae Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 7 Aug 2016 15:27:28 +0200 Subject: [PATCH] improve the doc of simgrid::SimulationClock from Gabriel's blog post --- include/simgrid/chrono.hpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/include/simgrid/chrono.hpp b/include/simgrid/chrono.hpp index 4395b41851..d3759cad03 100644 --- a/include/simgrid/chrono.hpp +++ b/include/simgrid/chrono.hpp @@ -19,7 +19,24 @@ namespace simgrid { -/** A C++ compatible TrivialClock working with simulated-time */ +/** @brief A C++ compatible [TrivialClock](http://en.cppreference.com/w/cpp/concept/TrivialClock) working with simulated-time. + * + * SimGrid uses `double` for representing the simulated time, where *durations* are expressed in seconds + * (with *infinite duration* expressed as a negative value) and + * *timepoints* are expressed as seconds from the beginning of the simulation. + * In contrast, all the C++ APIs use the much more sensible `std::chrono::duration` and`std::chrono::time_point`. + * + * This class can be used to build `std::chrono` objects that use simulated time, + * using #SimulationClockDuration and #SimulationClockTimePoint. + * + * This means it is possible to use (since C++14): + * + * @code{cpp} + * using namespace std::chrono_literals; + * simgrid::s4u::actor::sleep_for(42s); + * @endcode + * + */ struct SimulationClock { using rep = double; using period = std::ratio<1>; -- 2.20.1