Update AtomicTimeAbsoluteSamples.java and AtomicTimeIncrementalSamples.java
This commit is contained in:
parent
b805b8d02e
commit
ecd8974c56
@ -94,7 +94,10 @@ public class AtomicTimeAbsoluteSamples implements AtomicTimeAbsoluteSamplesSnaps
|
||||
preciseTimeRange = currentSampleStartTime - startTime;
|
||||
}
|
||||
|
||||
double samplesCount = Math.min(Math.max(preciseTimeRange / sampleTime, 1d), samples.length);
|
||||
double samplesCount = Math.min(Math.max(preciseTimeRange / sampleTime, 1d), samples.length - 1);
|
||||
if (samplesCount < 0) {
|
||||
return 0;
|
||||
}
|
||||
double value = 0;
|
||||
for (int i = 1; i <= samplesCount; i++) {
|
||||
value += samples[i];
|
||||
|
@ -87,7 +87,10 @@ public class AtomicTimeIncrementalSamples implements AtomicTimeIncrementalSample
|
||||
preciseTimeRange = currentSampleStartTime - startTime;
|
||||
}
|
||||
|
||||
double samplesCount = Math.min(Math.max(preciseTimeRange / sampleTime, 1d), samples.length);
|
||||
double samplesCount = Math.min(Math.max(preciseTimeRange / sampleTime, 1d), samples.length - 1);
|
||||
if (samplesCount < 0) {
|
||||
return 0;
|
||||
}
|
||||
double roundedTimeRange = samplesCount * sampleTime;
|
||||
double value = 0;
|
||||
for (int i = 1; i <= samplesCount; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user