On 10/16/2013 03:57 PM, Steven McCoy wrote:
> On 16 October 2013 06:11, Bjorn Reese <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Alternatively, we could upgrade to C++11 and get a portable solution
>     with std::chrono::steady_clock
>
>
> Ok, here you go: "/a steady clock is not necessarily monotonic/".
>
> https://svn.boost.org/trac/boost/ticket/7719

I was suggesting std::chrono, but boost::chrono. However, there appears
to be a problem with std::chrono::steady_clock for MSVC:

http://connect.microsoft.com/VisualStudio/feedback/details/753115/steady-clock-class-and-clock-function-are-non-conformant-with-c-11-and-c11-standards

A workaround for this (and indeed for all the other alternatives
suggested in this thread) is to create our own wrapper that handles
the missing monotonicity with a modified Lamport timestamp.

The idea is to maintain an offset that will be added to the clock when
calling now(). Whenever the clock goes back in time, the offset is
increased accordingly. That should be sufficient to guarantee a
monotonic clock regardless of the underlying clock.

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to