Update AtomicTimeAbsoluteSamples.java and AtomicTimeIncrementalSamples.java

This commit is contained in:
Andrea Cavalli 2020-07-17 19:58:01 +02:00
parent f0f7e609c0
commit ddfeaade4f
2 changed files with 2 additions and 2 deletions

View File

@ -97,7 +97,7 @@ public class AtomicTimeAbsoluteSamples implements AtomicTimeAbsoluteSamplesSnaps
double samplesCount = Math.min(Math.max(preciseTimeRange / sampleTime, 1d), samples.length);
double value = 0;
for (int i = 0; i < samplesCount; i++) {
for (int i = samplesCount == 1 ? 0 : 1; i < samplesCount; i++) {
double sampleValue;
if (i == 0) {
sampleValue = samples[i] * sampleTime / (double) (currentTime - currentSampleStartTime);

View File

@ -91,7 +91,7 @@ public class AtomicTimeIncrementalSamples implements AtomicTimeIncrementalSample
double samplesCount = Math.min(Math.max(preciseTimeRange / sampleTime, 1d), samples.length);
double roundedTimeRange = samplesCount * sampleTime;
double value = 0;
for (int i = 0; i < samplesCount; i++) {
for (int i = samplesCount == 1 ? 0 : 1; i < samplesCount; i++) {
double sampleValue;
if (i == 0) {
sampleValue = samples[i] * sampleTime / (double) (currentTime - currentSampleStartTime);