From b8cdd036a011eddc415fe652dfad09e73b2a1a56 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 16 Jan 2023 18:52:04 -0800 Subject: [PATCH] Add CRM_Utils_Time::delta() --- CRM/Utils/Time.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CRM/Utils/Time.php b/CRM/Utils/Time.php index dd56d6b9e4..dab77826d5 100644 --- a/CRM/Utils/Time.php +++ b/CRM/Utils/Time.php @@ -74,6 +74,16 @@ class CRM_Utils_Time { return self::$callback === NULL ? time() : call_user_func(self::$callback); } + /** + * Get the simulation offset. + * + * @return int + * Seconds between logical time and real time. + */ + public static function delta(): int { + return self::$callback === NULL ? 0 : (call_user_func(self::$callback) - time()); + } + /** * Get the time. * -- 2.25.1