From efa89e075fb9f2b1f6aa9d3a0c8ace508f021274 Mon Sep 17 00:00:00 2001 From: veselcraft Date: Sat, 25 Dec 2021 14:21:39 +0300 Subject: [PATCH] Global: Define standard unix time values Thanks @vladislav805 for the idea! --- Web/Models/Entities/User.php | 2 +- bootstrap.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index e810bf0f..81d6cc08 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -324,7 +324,7 @@ class User extends RowModel function getAge(): ?int { - return (int)floor((time() - $this->getBirthday()->timestamp()) / mktime(0, 0, 0, 1, 1, 1971)); + return (int)floor((time() - $this->getBirthday()->timestamp()) / YEAR); } function get2faSecret(): ?string diff --git a/bootstrap.php b/bootstrap.php index 1a52140c..c4ac5395 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -232,6 +232,14 @@ return (function() { else $ver = "Build 15"; + // Unix time constants + define('MINUTE', 60); + define('HOUR', 60 * MINUTE); + define('DAY', 24 * HOUR); + define('WEEK', 7 * DAY); + define('MONTH', 30 * DAY); + define('YEAR', 365 * DAY); + define("nullptr", NULL); define("OPENVK_DEFAULT_INSTANCE_NAME", "OpenVK", false); define("OPENVK_VERSION", "Altair Preview ($ver)", false);