/** * Calculate and set default time zone * * @access public * @static * @return time zone string */ public static function _getDefaultTimeZone() { if (strlen(self::$default_timezone)) { return self::$default_timezone; } // PHP >= 5.2.0 if (function_exists('date_default_timezone_get') and $tz = date_default_timezone_get()) { return self::$default_timezone = $tz; } // PHP ini option (PHP >= 5.1.0) if ($tz = ini_get('date.timezone')) { return self::$default_timezone = $tz; } // is $_ENV['PHP_TZ'] set ? if ($tz = getenv('PHP_TZ')) { return self::$default_timezone = $tz; } // is $_ENV['TZ'] set ? if ($tz = getenv('TZ')) { return self::$default_timezone = $tz; } if (strlen($tz = date('T'))) { return self::$default_timezone = $tz; } return self::$default_timezone = self::UTC; }