Timezone#
This is the ICalTimezone instance.
Constructors#
Methods#
- class Timezone
- classmethod array_append_from_vtimezone(child: Component) None#
Populate the array of timezones with a component.
noteThetimezonesassumes ownership of thechild, thus make sure you pass an unownedComponent.Added in version 1.0.
- Parameters:
child – The component to be appended to
timezones
- classmethod array_element_at(index: int) Timezone#
Gets the
Timezoneat specified position in array.Added in version 1.0.
- Parameters:
index – The index
- dump_changes(max_year: int, fp: Any = None) int#
Outputs a list of timezone changes for the given timezone to the given file, up to the maximum year given.
Added in version 1.0.
- Parameters:
max_year – Max year
fp – The file handle
- classmethod free_builtin_timezones() None#
Frees any builtin timezone information.
Added in version 1.0.
- classmethod free_zone_directory() None#
Frees memory dedicated to the zonefile directory.
Added in version 1.0.
- classmethod get_builtin_timezone() Timezone | None#
Returns a single builtin timezone, given its Olson city name.
Added in version 1.0.
- classmethod get_builtin_timezone_from_offset(tzname: str | None = None) Timezone#
Returns a single builtin timezone, given its offset.
Added in version 1.0.
- Parameters:
tzname – The reference
Timezonename
- classmethod get_builtin_timezone_from_tzid() Timezone#
Returns a single builtin timezone, given its TZID.
Added in version 1.0.
- classmethod get_builtin_timezones() Array#
Returns a list of builtin timezones.
Added in version 1.0.
- classmethod get_builtin_tzdata() bool#
Gets whether to use builtin timezones files.
Added in version 2.0.
- get_location() str | None#
Returns the city name of a timezone, or
None, when none is set or whenzoneis alsoNone.Added in version 1.0.
- classmethod get_location_from_vtimezone() str#
Gets the location of the vtimezone in component.
Added in version 2.0.
- get_tzid() str | None#
Returns the TZID of a timezone, or
None, when none is set or whenzoneis alsoNone.Added in version 1.0.
- get_tznames() str | None#
Returns the TZNAME properties used in the latest STANDARD and DAYLIGHT components. If they are the same it will return just one, e.g. “LMT”. If they are different it will format them like “EST/EDT”. Note that this may also return NULL.
Added in version 1.0.
- classmethod get_tznames_from_vtimezone() str#
Gets the name of the vtimezone in component.
Added in version 2.0.
- get_utc_offset(tt: Time | None = None) tuple[int, int]#
Calculates the UTC offset of a given local time in the given timezone. It is the number of seconds to add to UTC to get local time. The is_daylight flag is set to 1 if the time is in daylight-savings time.
Added in version 1.0.
- Parameters:
tt – The local time
- get_utc_offset_of_utc_time(tt: Time) tuple[int, int]#
Calculates the UTC offset of a given UTC time in the given timezone. It is the number of seconds to add to UTC to get local time. The is_daylight flag is set to 1 if the time is in daylight-savings time.
Added in version 1.0.
- Parameters:
tt – The local time
- classmethod get_zone_directory() str#
Gets the directory to look for the zonefiles.
Added in version 3.0.17.
- classmethod release_zone_tab() None#
Frees memory dedicated to the zonefile directory.
Added in version 1.0.
- classmethod set_builtin_tzdata() None#
Sets whether to use builtin timezones files.
Added in version 2.0.
- set_component(comp: Component) int#
Sets the VTIMEZONE component of
Timezone, initializing the tzid, location and tzname fields. It returns 1 on success or 0 on failure, i.e. no TZID was found.noteThezoneassumes ownership of thecomp, thus make sure you pass an unownedComponent.Added in version 1.0.
- Parameters:
comp – The VTIMEZONE component of an
Timezone, initializing the tzid, location and tzname fields
- classmethod set_tzid_prefix() None#
Sets the prefix to be used for tzid’s generated from system tzdata. Must be globally unique (such as a domain name owned by the developer of the calling application), and begin and end with forward slashes. Do not change or de-allocate the string buffer after calling this.
Added in version 1.0.