There are two things about the C++:

1) why use a class for the timer?

2) It's not clear if the order of operations ensures that the timer is stopped before the first print operation happens. Thus your C++ may be including some part of the cout print operation

Re: 2, I am surprised if operations with side-effects get called out of order.

Site's down, so I can't pull up the exact link, but the java code basically did

    get time
    do it
    get time again
    print timing info

The C++ code had a line of the form

    cout << .... << some_method_which_stops_time_and_returns << ...
So unless G++ is doing some sort of whole program analysis, it would have to do the cout << ... first and then evaluate the method and then print out the return value
Here's the link to the github account where the code is: https://github.com/lemire/Code-used-on-Daniel-Lemire-s-blog/...

Even if they're doing whole program analysis, the fact that oeprator<<() and WallClockTimer.split() are side-effectful and I believe that means that it would be invalid for the compiler to find the current time before the first section of the print statement is finished.