summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/helpers/date_helper.php2
-rw-r--r--system/libraries/Session.php14
2 files changed, 12 insertions, 4 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index b818da9d8..131508f69 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -52,7 +52,7 @@ if ( ! function_exists('now'))
{
if (empty($timezone))
{
- $timezone = config_item('timezone');
+ $timezone = config_item('time_reference');
}
if ($timezone === 'local' OR $timezone === date_default_timezone_get())
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);
}
// --------------------------------------------------------------------