summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-14 01:43:07 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-14 01:43:07 +0200
commit35d6b35182b6ed65c34ca7bf06975b93f4cd403b (patch)
tree550e2351d5670951033338c9d394ca647ce584ee /system/libraries
parentd461934184d95b0cfb2feec93f27b621ef72a5c2 (diff)
parent7400965017f87c3aba18bf75ed7d732359fd577d (diff)
Merge pull request #1223 from Razican/new_date
New now() function for the Date helper
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Session.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 7beedd96b..9fdf744c3 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -786,9 +786,17 @@ class CI_Session {
*/
protected function _get_time()
{
- return (strtolower($this->time_reference) === 'gmt')
- ? mktime(gmdate('H'), gmdate('i'), gmdate('s'), gmdate('m'), gmdate('d'), gmdate('Y'))
- : time();
+ $timezone = config_item('time_reference');
+
+ if ($timezone === 'local' OR $timezone === date_default_timezone_get())
+ {
+ return time();
+ }
+
+ $datetime = new DateTime('now', new DateTimeZone($timezone));
+ sscanf($datetime->format('j-n-Y G:i:s'), '%d-%d-%d %d:%d:%d', $day, $month, $year, $hour, $minute, $second);
+
+ return mktime($hour, $minute, $second, $month, $day, $year);
}
// --------------------------------------------------------------------