unsubmitted segments are initialized rounded to 3 digits

This commit is contained in:
FlorianZahn
2021-10-21 03:14:45 +02:00
parent 510db57666
commit 9dda9a583d
2 changed files with 13 additions and 3 deletions

View File

@@ -1459,9 +1459,10 @@ function getRealCurrentTime(): number {
}
function startOrEndTimingNewSegment() {
const roundedTime = Math.round((getRealCurrentTime() + Number.EPSILON) * 1000) / 1000;
if (!isSegmentCreationInProgress()) {
sponsorTimesSubmitting.push({
segment: [getRealCurrentTime()],
segment: [roundedTime],
UUID: null,
category: Config.config.defaultCategory,
actionType: ActionType.Skip,
@@ -1471,7 +1472,7 @@ function startOrEndTimingNewSegment() {
// Finish creating the new segment
const existingSegment = getIncompleteSegment();
const existingTime = existingSegment.segment[0];
const currentTime = getRealCurrentTime();
const currentTime = roundedTime;
// Swap timestamps if the user put the segment end before the start
existingSegment.segment = [Math.min(existingTime, currentTime), Math.max(existingTime, currentTime)];