If mHandler will start execute addSample() at least 1ms after updating mLastTimeReading in startSampling() then IF in addSample will not work and we will add sample with incorrectly small time
if (timeInMs == 0 || ...
public void startSampling() { if (mSamplingCounter.getAndIncrement() == 0) { mHandler.startSamplingThread(); mLastTimeReading = SystemClock.elapsedRealtime(); } }
If mHandler will start execute addSample() at least 1ms after updating mLastTimeReading in startSampling() then IF in addSample will not work and we will add sample with incorrectly small time
if (timeInMs == 0 || ...
public void startSampling() { if (mSamplingCounter.getAndIncrement() == 0) { mHandler.startSamplingThread(); mLastTimeReading = SystemClock.elapsedRealtime(); } }