41 include_once(
'Services/Calendar/classes/class.ilTimeZoneException.php');
73 $this->timezone = $a_timezone;
80 if(!self::$server_timezone)
85 if(!self::$default_timezone)
120 if(isset(self::$instances[$a_tz]))
122 $instance = self::$instances[$a_tz];
126 $instance = self::$instances[$a_tz] =
new ilTimeZone($a_tz);
132 if(!$instance->validateTZ())
136 self::$valid_tz[$instance->getIdentifier()] =
true;
158 $this->log->write(__METHOD__.
': Unsupported timezone given: Timzone: '.$this->timezone);
178 $this->log->write(__METHOD__.
': Unsupported timezone given: Timzone: '.$this->timezone);
210 if(self::$current_timezone == $a_timezone)
212 #$ilLog->write(__METHOD__.': Do not switch to active timezone: '.$a_timezone);
217 if(function_exists(
'date_default_timezone_set'))
219 if(!date_default_timezone_set($a_timezone))
221 $ilLog->write(__METHOD__.
': Invalid timezone given. Timezone: '.$a_timezone);
224 #$ilLog->write(__METHOD__.': Switched timezone to: '.$a_timezone);
225 self::$current_timezone = $a_timezone;
228 if(!putenv(
'TZ='.$a_timezone))
230 $ilLog->write(__METHOD__.
': Cannot set TZ environment variable. Please register TZ in php.ini (safe_mode_allowed_env_vars). Timezone');
233 self::$current_timezone = $a_timezone;
248 if(!self::$server_timezone)
253 self::$default_timezone = $a_tz;
279 if(strlen(self::$default_timezone))
284 if(function_exists(
'date_default_timezone_get') and $tz = date_default_timezone_get())
286 return self::$default_timezone = $tz;
289 if($tz = ini_get(
'date.timezone'))
291 return self::$default_timezone = $tz;
294 if($tz = getenv(
'PHP_TZ'))
296 return self::$default_timezone = $tz;
299 if($tz = getenv(
'TZ'))
301 return self::$default_timezone = $tz;
303 if(strlen($tz = date(
'T')))
305 return self::$default_timezone = $tz;
307 return self::$default_timezone =
self::UTC;