There are two variants of this method. "now" and "hardNow". By default, they do exactly the same thing:
report the time right now, as reported by the cycles counter in the CPU.
As fetching the cycles counter may be relatively expensive, threads that do a lot of time keeping may find that getting
the hardware counter each and every time is too costly. In that case, you can call "setHardNowThreshold" with a threshold.
Calling, e.g. setHardNow(3) will mean that now will call hardNow every third invocation.
Even when now doesn't call hardNow, it is still guaranteed to montoniously advance, but it not guaranteed to be accurate.
A good rule of thumb is this: If you use requires getting the time on a semi-regular basis, call now whenever precise
time is not required. If your use requires time only sporadically, only use hardNow.
Warning:
now does not guarantee monotonity across different threads. If you need different threads to have comparable times, use
hardNow.
Get a TscTimePoint representing now.
There are two variants of this method. "now" and "hardNow". By default, they do exactly the same thing: report the time right now, as reported by the cycles counter in the CPU.
As fetching the cycles counter may be relatively expensive, threads that do a lot of time keeping may find that getting the hardware counter each and every time is too costly. In that case, you can call "setHardNowThreshold" with a threshold. Calling, e.g. setHardNow(3) will mean that now will call hardNow every third invocation.
Even when now doesn't call hardNow, it is still guaranteed to montoniously advance, but it not guaranteed to be accurate.
A good rule of thumb is this: If you use requires getting the time on a semi-regular basis, call now whenever precise time is not required. If your use requires time only sporadically, only use hardNow.
Warning: now does not guarantee monotonity across different threads. If you need different threads to have comparable times, use hardNow.