Global: Define standard unix time values

Thanks @vladislav805 for the idea!
This commit is contained in:
veselcraft 2021-12-25 14:21:39 +03:00
parent 5d47549442
commit efa89e075f
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E
2 changed files with 9 additions and 1 deletions

View file

@ -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

View file

@ -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);