mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
Merge remote-tracking branch 'github-bantu/ticket/10243' into develop-olympus
* github-bantu/ticket/10243: [ticket/10243] Adding a few unit tests for phpbb_gmgetdate(). [ticket/10243] Call phpbb_gmgetdate() from various places. [ticket/10243] Adding wrapper function for getdate() for UTC timestamps.
This commit is contained in:
@@ -265,6 +265,27 @@ function phpbb_mt_rand($min, $max)
|
||||
return ($min > $max) ? mt_rand($max, $min) : mt_rand($min, $max);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for getdate() which returns the equivalent array for UTC timestamps.
|
||||
*
|
||||
* @param int $time Unix timestamp (optional)
|
||||
*
|
||||
* @return array Returns an associative array of information related to the timestamp.
|
||||
* See http://www.php.net/manual/en/function.getdate.php
|
||||
*/
|
||||
function phpbb_gmgetdate($time = false)
|
||||
{
|
||||
if ($time === false)
|
||||
{
|
||||
$time = time();
|
||||
}
|
||||
|
||||
// getdate() interprets timestamps in local time.
|
||||
// What follows uses the fact that getdate() and
|
||||
// date('Z') balance each other out.
|
||||
return getdate($time - date('Z'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return formatted string for filesizes
|
||||
*
|
||||
|
Reference in New Issue
Block a user