-
- Downloads
osv/clock.hh: Add std::chrono::duration literals
In <drivers/clock.hh> we had support for time literals looking like 100_ns, 100_us, 100_ms, 100_s. These simply translated to an integer number of nanoseconds. Added to <osv/clock.hh> similar literals, but using strongly-typed std::chrono::duration, so that 100_ms translates to std::chrono::milliseconds(100), and this is, as usual, automatically scaled by the compiler to other units when other units (e.g., nanoseconds) are required. Because the literals of <drivers/clock.hh> and <osv/clock.hh> have the same name, to use the latter you need to explicitly enable them in a scope using the statement using namespace osv::clock::literals; One the entire codebase is converted to use <osv/clock.hh> and std::chrono, the old literals from <drivers/clock.hh> should be removed. Signed-off-by:Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
Loading
Please register or sign in to comment