Set PHP default timezone to $CFG->timezone.
331805
public static function set_default_server_timezone() {
        global $CFG;

        if (!isset($CFG->timezone) or $CFG->timezone == 99 or $CFG->timezone === '') {
            date_default_timezone_set(self::get_default_php_timezone());
            return;
        }

        $current = date_default_timezone_get();
        if ($current === $CFG->timezone) {
            // Nothing to do.
            return;
        }

        if (!isset(self::$goodzones)) {
            // For better performance try do do this without full tz init,
            // because this is called from lib/setup.php file on each page.
            $result = @timezone_open($CFG->timezone); // Ignore error if setting invalid.
            if ($result !== false) {
                date_default_timezone_set($result->getName());
                return;
            }
        }

        // Slow way is the last option.
        date_default_timezone_set(self::get_server_timezone());
    }
962891
public static function get_server_timezone() {
        global $CFG;

        if (!isset($CFG->timezone) or $CFG->timezone == 99 or $CFG->timezone === '') {
            return self::get_default_php_timezone();
        }

        return self::normalise_timezone($CFG->timezone);
    }
115836
def _get_timezone(self, root):
        """"""
        tz_str = root.xpath('//div[@class="smallfont" and @align="center"]')[0].text
        hours = int(self._tz_re.search(tz_str).group(1))
        return tzoffset(tz_str, hours * 60)
1069443
def c_time_locale():
    """"""
    old_time_locale = locale.getlocale(locale.LC_TIME)
    locale.setlocale(locale.LC_TIME, 'C')
    yield
    locale.setlocale(locale.LC_TIME, old_time_locale)
682083
public void setTimeZone(TimeZone tz)
    {
        setTzFormatString(tz);        
        if( _locale != null ) 
        {
            _tzFormat=new SimpleDateFormat(_tzFormatString,_locale);
            _minFormat=new SimpleDateFormat(_minFormatString,_locale);
        }
        else if( _dfs != null ) 
        {
            _tzFormat=new SimpleDateFormat(_tzFormatString,_dfs);
            _minFormat=new SimpleDateFormat(_minFormatString,_dfs);
        }
        else 
        {
            _tzFormat=new SimpleDateFormat(_tzFormatString);
            _minFormat=new SimpleDateFormat(_minFormatString);
        }
        _tzFormat.setTimeZone(tz);
        _minFormat.setTimeZone(tz);
        _lastSeconds=-1;
        _lastMinutes=-1;        
    }
272316
public static function phpunit_override_default_php_timezone($tz) {
        if (!defined('PHPUNIT_TEST')) {
            throw new coding_exception('core_date::phpunit_override_default_php_timezone() must be used only from unit tests');
        }
        $result = timezone_open($tz); // This triggers error if $tz invalid.
        if ($result !== false) {
            self::$defaultphptimezone = $tz;
        } else {
            self::$defaultphptimezone = 'Australia/Perth';
        }
    }
1095442
protected function configure()
    {
        if (is_readable($configFile = $this->config('config.path') . '/config.php')) {
            $config = include $configFile;
            if (!is_array($config)) {
                $config = (array) $config;
            }
            $this->config($config);
        }
        if (is_readable($configFile = $this->config('config.path') . '/config-' . $this->config('mode') . '.php')) {
            $config = include $configFile;
            if (!is_array($config)) {
                $config = (array) $config;
            }
            $this->config($config);
        }

        date_default_timezone_set($this->config('bono.timezone') ?: 'UTC');
    }
1279664
def AddTimeZoneOption(self, argument_group):
    
    # Note the default here is None so we can determine if the time zone
    # option was set.
    argument_group.add_argument(
        '-z', '--zone', '--timezone', dest='timezone', action='store',
        type=str, default=None, help=(
            'explicitly define the timezone. Typically the timezone is '
            'determined automatically where possible otherwise it will '
            'default to UTC. Use "-z list" to see a list of available '
            'timezones.'))
1028292
def save(self, *args, **kwargs):
        """"""
        if self.timestamp is None:
            self.timestamp = timezone.now()

        super().save(*args, **kwargs)
15824
public function setDefault($timeZone): void
    {
        if (is_string($timeZone) || $timeZone instanceof DateTimeZone) {
            $timeZone = $this->getTimeZone($timeZone);
        }
        $this->timeZoneClass->setDefault($timeZone);
        self::$defaultTz = $timeZone;
    }
828513
protected function configureTimezone($connection, array $config)
    {
        if (isset($config['timezone'])) {
            $timezone = $config['timezone'];

            $connection->prepare("set time zone '{$timezone}'")->execute();
        }
    }
1243578
private function setPhpConfig()
    {
        if (function_exists('ini_set')) {
            if ($this->config->error->log) {
                ini_set('log_errors', true);
                ini_set('error_log', Rails::config()->log_file);
            }
        }
        
        if ($this->config['date']['timezone']) {
            date_default_timezone_set($this->config['date']['timezone']);
        } elseif (function_exists('ini_get')) {
            if (!ini_get('date.timezone') && !date_default_timezone_get()) {
                throw new Exception\RuntimeException(
                    "date.timezone directive doesn't seem to have a value. " .
                    "You are requested to either set a value in your php.ini or in your application's configuration (date->timezone)"
                );
            }
        }
        
        if ($this->config()->session->start && !Rails::cli()) {
            if ($session_name = $this->config()->session->name) {
                session_name($session_name);
            }
            session_start();
        }
        
        if ($paths = $this->config()->eager_load_paths->toArray()) {
            Rails::loader()->addPaths($paths);
            set_include_path(get_include_path() . PATH_SEPARATOR . implode(PATH_SEPARATOR, $paths));
        }
        
        set_error_handler('Rails::errorHandler', $this->config()->error->report_types);
    }
563980
def tz(self):
        """"""

        if self.timezone is None:
            return None

        try:
            tz = pytz.timezone(self.timezone)
            return tz
        except pytz.UnknownTimeZoneError:
            raise AstralError("Unknown timezone '%s'" % self.timezone)
1130664
def timezone(utcoffset):
    '''
    

    '''

    hours, seconds = divmod(abs(utcoffset), 3600)
    minutes = round(float(seconds) / 60)

    if utcoffset >= 0:
        sign = '+'
    else:
        sign = '-'
    return '{0}{1:02d}:{2:02d}'.format(sign, int(hours), int(minutes))
1112270
def formfield(self, **kwargs):
        """"""

        defaults = {'form_class': forms.TimeZoneField}
        defaults.update(**kwargs)
        return super(TimeZoneField, self).formfield(**defaults)
754548
def timezone(self, tz):
        
        self.data['resolving'].update(
            timezone=tz,
            time_show_zone=True)
14100
private function loadTimezone() {
		
		if (!is_null($this->id) and (is_null($this->tzName) or is_null($this->tzOffset))) {
			
			$this->db->setQuery('SELECT timezone_name, timezone_offset FROM `sessions` WHERE id_user = ?');
			$obj = $this->db->loadObject($this->id);
			$this->tzOffset	= $obj->timezone_offset;
			$this->tzName	= $obj->timezone_name;
			
		}
		
	}