From 204a6a79803b17b14cf663a11471a625bb0e9eaa Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Tue, 10 Jul 2012 15:29:26 +0300 Subject: [PATCH 1/2] Add a Request::time() function. --- laravel/request.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/laravel/request.php b/laravel/request.php index 84763449..a37360a2 100644 --- a/laravel/request.php +++ b/laravel/request.php @@ -177,6 +177,25 @@ class Request { { return static::foundation()->headers->get('referer'); } + + /** + * Get the timestamp of the time when the request was started. + * + * The value is actually calculated when this function gets first called. + * + * @return int + */ + public static function time() + { + static $time; + + if (!isset($time)) + { + $time = time(); + } + + return $time; + } /** * Determine if the current request is via the command line. From 37dbeef2bb15b068ae6bb6bba463848883770a19 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Mon, 30 Jul 2012 13:48:55 +0300 Subject: [PATCH 2/2] Use LARAVEL_START constant to calculate request time. Suggested by @Kindari. --- laravel/request.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/laravel/request.php b/laravel/request.php index a37360a2..306a94c1 100644 --- a/laravel/request.php +++ b/laravel/request.php @@ -181,20 +181,11 @@ class Request { /** * Get the timestamp of the time when the request was started. * - * The value is actually calculated when this function gets first called. - * * @return int */ public static function time() { - static $time; - - if (!isset($time)) - { - $time = time(); - } - - return $time; + return (int) LARAVEL_START; } /**