diff options
author | Nils Adermann <naderman@naderman.de> | 2011-07-16 22:06:49 -0400 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2011-07-16 22:06:49 -0400 |
commit | a33b67fd1a80463602c3603f72ad0f96dd3d9b09 (patch) | |
tree | c5304bb4d38ddb3ee224cb0ddac32bd463d169d2 /phpBB/includes | |
parent | 19925ad059a31282467c061a76fb387d2206b357 (diff) | |
parent | 0f86034f03c8b81883aed2345d88d197f72c7491 (diff) | |
download | forums-a33b67fd1a80463602c3603f72ad0f96dd3d9b09.tar forums-a33b67fd1a80463602c3603f72ad0f96dd3d9b09.tar.gz forums-a33b67fd1a80463602c3603f72ad0f96dd3d9b09.tar.bz2 forums-a33b67fd1a80463602c3603f72ad0f96dd3d9b09.tar.xz forums-a33b67fd1a80463602c3603f72ad0f96dd3d9b09.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[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.
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ed183b3e76..6bc5c6e0f4 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -207,6 +207,27 @@ function phpbb_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 * * @param int $value filesize in bytes |