js/timeManager.js
function tick(frameTime){

    let newFrameUnixTime = utils.getUnixTimeInMilliseconds();
    if (frameTime)
        frameDuration = frameTime;
    else
        frameDuration = newFrameUnixTime - frameUnixTime;
    

    // dont consider frame duration if app is not active
    frameDurationClone = appActive ? frameDuration : 0;

    frameUnixTime = newFrameUnixTime;
    timeSinceStart += frameDurationClone;

    if (appPlaying){

        playTimeSinceStart += frameDurationClone;
        
    }

    if (videoPlaying){

        videoDuration += utils.convertMillisecondsToSecondsFloat(frameDurationClone);

    }

}
function tick(frameTime){

    let newFrameUnixTime = utils.getUnixTimeInMilliseconds();
    if (frameTime)
        frameDuration = frameTime;
    else
        frameDuration = newFrameUnixTime - frameUnixTime;
    

    // dont consider frame duration if app is not active
    frameDurationClone = appActive ? frameDuration : 0;

    frameUnixTime = newFrameUnixTime;
    timeSinceStart += frameDurationClone;

    if (appPlaying){

        playTimeSinceStart += frameDurationClone;
        
    }

    if (videoPlaying){

        videoDuration += utils.convertMillisecondsToSecondsFloat(frameDurationClone);

    }

}
function tick ( frameTime ) { let newFrameUnixTime = utils . getUnixTimeInMilliseconds ( ) ; if ( frameTime ) frameDuration = frameTime ; else frameDuration = newFrameUnixTime - frameUnixTime ; // dont consider frame duration if app is not active frameDurationClone = appActive ? frameDuration : 0 ; frameUnixTime = newFrameUnixTime ; timeSinceStart += frameDurationClone ; if ( appPlaying ) { playTimeSinceStart += frameDurationClone ; } if ( videoPlaying ) { videoDuration += utils . convertMillisecondsToSecondsFloat ( frameDurationClone ) ; } }
Updates the application timings.
Calculates frameTime as the difference of current
frame time and the previous frame time. In case app was not active the previous frame,
sets the frame time to 0. Correspondingly calculates timeSinceStart and
playTimeSinceStart
@memberof TimeManager
@param {number} frameTime specify the frameDuration if known [optional]
Updates the application timings . Calculates frameTime as the difference of current frame time and the previous frame time . In case app was not active the previous frame sets the frame time to 0 . Correspondingly calculates timeSinceStart and playTimeSinceStart