From 6acaac8064ddc8506f4c3e6d09190704c8e352fe Mon Sep 17 00:00:00 2001 From: TEParsons Date: Thu, 19 Sep 2024 10:10:07 +0100 Subject: [PATCH] PAR: Mirror the Clock.addTime function from PsychoPy --- src/util/Clock.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/util/Clock.js b/src/util/Clock.js index 51143d35..f103c604 100644 --- a/src/util/Clock.js +++ b/src/util/Clock.js @@ -135,6 +135,19 @@ export class Clock extends MonotonicClock } /** + * Progress the current time of the clock. + * + * @param {number} [deltaTime] the time (s) to be added to the clock's current time + */ + addTime(deltaTime) + { + this._timeAtLastReset -= deltaTime; + } + + /** + * DEPRECATED: Clock.add() is deprecated in favor of .addTime() due to the counterintuitive + * design (it added time to the baseline, which reduced the values returned from getTime() ) + * * Add more time to the clock's 'start' time (t0). * *

Note: by adding time to t0, the current time is pushed forward (it becomes