Read TZif, time zone information, files(zic output).
| WARNING | |
This module is intended for internal use only. The APIs are subject to change without notice. |
os0
struct0
collections0
magic0
magic = b'TZif'
tzdir0
tzdir = '/usr/share/zoneinfo'
tzdefault0
tzdefault = '/etc/localtime'
tzenviron0
tzenviron = 'TZ'
header_fields0
header_fields = (
'tzh_ttisgmtcnt', # The number of UTC/local indicators stored in the file.
'tzh_ttisstdcnt', # The number of standard/wall indicators stored in the file.
'tzh_leapcnt', # The number of leap seconds for which data is stored in the file.
'tzh_timecnt', # The number of `transition times` for which data is stored in the file.
'tzh_typecnt', # The number of `local time types` for which data is stored in the file (must not be zero).
'tzh_charcnt', # The number of characters of `time zone abbreviation strings` stored in the file.
)
tzinfo_header0
tzinfo_header = collections.namedtuple('tzinfo_header', header_fields)
header_struct_v10
header_struct_v1 = struct.Struct("!" + (len(header_fields) * "l"))
header_struct_v20
header_struct_v2 = struct.Struct("!" + (len(header_fields) * "q"))
ttinfo_fields0
ttinfo_fields = (
'tt_gmtoff',
'tt_isdst',
'tt_abbrind',
)
tzinfo_ttinfo0
tzinfo_ttinfo = collections.namedtuple('tzinfo_ttinfo', ttinfo_fields)
ttinfo_struct_v10
ttinfo_struct_v1 = struct.Struct("!lbb")
ttinfo_struct_v20
ttinfo_struct_v2 = struct.Struct("!qbb")
transtime_struct_v10
transtime_struct_v1 = struct.Struct("!l")
leappairs_struct_v10
leappairs_struct_v1 = struct.Struct("!ll")
transtime_struct_v20
transtime_struct_v2 = struct.Struct("!q")
leappairs_struct_v20
leappairs_struct_v2 = struct.Struct("!qq")
tzinfo0
tzinfo = collections.namedtuple('tzinfo', (
'header',
'transitional_times',
'types',
'typinfo'
))
tzinfo = collections.namedtuple('tzinfo', (
'tz_abbrev',
'tz_offset',
'tz_isdst',
'tz_isstd',
'tz_isgmt',
))
parse_version_10
parse_version_1(data)
parse the raw data from a TZif file. 4-byte longs.
Returns tuple of: (transtimes, types, timetypinfo, leaps, isstd, isgmt, abbr) See tzfile(5) for information about the fields.
parse_version_2250%
parse_version_2(data)
parse the raw data from a version 2 TZif file. 8-byte longs.
Returns tuple of: (transtimes, types, timetypinfo, leaps, isstd, isgmt, abbr) See tzfile(5) for information about the fields.
parse183%
parse(data)
Given TZif data, identify the appropriate version and unpack the timezone information.
structure0
structure(tzif)
Given the parse fields from parse(), make a more accessible structure.
system_timezone_file10%
system_timezone_file(relativepath)
get_timezone_data0
get_timezone_data(filepath)
Get the structured timezone data out of the specified file.
abbreviations100%
abbreviations(tzdir)
Yield all abbreviations in the TZif files in the tzdir(/usr/share/zoneinfo).
abbreviation_map140%
abbreviation_map()
Generate and return a mapping of zone abbreviations to their particular offsets.
Using this should mean that you know that abbreviations are ambiguous. This function is provided to aid common cases and popular mappings.