I'd assumed that the monotonicity of System.nanoTime() on modern systems was due to the OS compensating, rather than any changes at the hardware level. Is that not the case?
In particular, Rust definitely still seems to think that their SystemTime (which looks to back directly on to a RDTSC) can be non-monotonic: https://doc.rust-lang.org/std/time/struct.SystemTime.html On Tue, 30 Apr 2019 at 07:50, dor laor <[email protected]> wrote: > > It might be since in the past many systems did not have a stable rdtsc and > thus if the instruction is executed > on different sockets it can result in wrong answers and negative time. Today > most systems do have a stable tsc > and you can verify it from userspace/java too. > I bet it's easy to google the reason > > On Mon, Apr 29, 2019 at 2:36 PM 'Carl Mastrangelo' via mechanical-sympathy > <[email protected]> wrote: >> >> This may be a dumb question, but why (on Linux) is System.nanotime() a call >> out to clock_gettime? It seems like it could be inlined by the JVM, and >> stripped down to the rdtsc instruction. From my reading of the vDSO source >> for x86, the implementation is not that complex, and could be copied into >> Java. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "mechanical-sympathy" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "mechanical-sympathy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
