Skip to content

Commit

Permalink
Merge pull request #133 from adobecom/MWPW-143651
Browse files Browse the repository at this point in the history
fix(mwpw-143651): fix timer-related bug by using performance.now()
  • Loading branch information
sheridansunier authored Mar 7, 2024
2 parents 6f45b82 + 83df454 commit da89727
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 35 deletions.
2 changes: 1 addition & 1 deletion dist/app.css

Large diffs are not rendered by default.

20 changes: 5 additions & 15 deletions dist/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Chimera UI Libraries - Build 0.11.12 (3/5/2024, 14:57:09)
* Chimera UI Libraries - Build 0.11.13 (3/7/2024, 14:57:25)
*
*/
/******/ (function(modules) { // webpackBootstrap
Expand Down Expand Up @@ -847,16 +847,11 @@ var isDateBeforeInterval = exports.isDateBeforeInterval = function isDateBeforeI
return curr < start;
};

var differential = 0;
function incrementDifferential() {
differential += 1000;
}
setInterval(incrementDifferential, 1000);

var getCurrentDate = exports.getCurrentDate = function getCurrentDate() {
var urlParams = new URLSearchParams(window.location.search);
var servertime = parseInt(urlParams.get('servertime'), 10);
var currDate = servertime ? new Date(servertime + differential) : new Date();
var timeSinceArrival = performance.now();
var currDate = servertime ? new Date(servertime + timeSinceArrival) : new Date();
return currDate;
};

Expand Down Expand Up @@ -48401,12 +48396,6 @@ var defineIsUpcoming = function defineIsUpcoming(currentTime, startTimeMls) {
return false;
};

var differential = 0;
function incrementDifferential() {
differential += 1000;
}
setInterval(incrementDifferential, 1000);

/**
* @func eventTiming
* @desc First Sorts sessions by startDate, and then partitions them by category
Expand Down Expand Up @@ -48441,7 +48430,8 @@ function eventTiming() {
If msAsNumber from urlState.servertime use this value, otherwise epoch
from Date.now(). This is mainly an override for QA purposes.
*/
var curMs = overrideTime + differential || Date.now();
var timeSinceArrival = performance.now();
var curMs = overrideTime + timeSinceArrival || Date.now();
// Stack per category
var live = [];
var notTimed = [];
Expand Down
6 changes: 3 additions & 3 deletions dist/main.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/main.source.js

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions react/src/js/components/Consonant/Helpers/eventSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ const defineIsUpcoming = (currentTime, startTimeMls) => {
return false;
};

let differential = 0;
function incrementDifferential() {
differential += 1000;
}
setInterval(incrementDifferential, 1000);

/**
* @func eventTiming
* @desc First Sorts sessions by startDate, and then partitions them by category
Expand Down Expand Up @@ -165,7 +159,8 @@ function eventTiming(sessions = [], eventFilter) {
If msAsNumber from urlState.servertime use this value, otherwise epoch
from Date.now(). This is mainly an override for QA purposes.
*/
const curMs = overrideTime + differential || Date.now();
const timeSinceArrival = performance.now();
const curMs = overrideTime + timeSinceArrival || Date.now();
// Stack per category
const live = [];
const notTimed = [];
Expand Down
9 changes: 2 additions & 7 deletions react/src/js/components/Consonant/Helpers/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,16 +474,11 @@ export const isDateBeforeInterval = (currentDate, startDate) => {
return curr < start;
};

let differential = 0;
function incrementDifferential() {
differential += 1000;
}
setInterval(incrementDifferential, 1000);

export const getCurrentDate = () => {
const urlParams = new URLSearchParams(window.location.search);
const servertime = parseInt(urlParams.get('servertime'), 10);
const currDate = servertime ? new Date(servertime + differential) : new Date();
const timeSinceArrival = performance.now();
const currDate = servertime ? new Date(servertime + timeSinceArrival) : new Date();
return currDate;
};

Expand Down

0 comments on commit da89727

Please sign in to comment.