Mstdlib-1.24.0
Mstdlib TZ File

Functions

M_time_result_t M_mtzfile_tzs_add_file (M_time_tzs_t *tzs, const char *path, size_t *err_line, char **err_sect, char **err_data)
 
M_time_result_t M_mtzfile_tzs_add_str (M_time_tzs_t *tzs, const char *data, size_t *err_line, char **err_sect, char **err_data)
 

Detailed Description

The Mstdlib TZ format is a simple way to describe timezone information. It is intended for use on systems that do not provide timezone information. Such as embedded systems. A time.zone file is provided in the formats/time directory in the source package which provides timezone descriptions for US, Canada, and Mexico.

The format is an ini file which can be parsed with m_ini. However, functions are provided here which will parse and load the format into a M_time_tzs_t object.

Format description:

Section define zones. Aliases are alternate names that identify the zone. The section must have an offset and abbreviation. The offset is assumed negative unless the value start explicitly with '+'. DST offsets and abbreviations are used when a DST rule is in effect. A DST rule is a Posix DST rule with the first part replaced with a year (the year the rule applies) followed by a ';'. For DST rules only the M day format is supported.

Example:

[EST5]
offset=5
abbr=EST
[EST5EDT]
alias=America/New_York
alias=America/Detroit
alias=America/Indiana/Indianapolis
offset=5
offset_dst=4
abbr=EST
abbr_dst=EDT
dst=2007;M3.2.0/02:00:00,M11.1.0/02:00:00
dst=1987;M4.1.0/02:00:00,M10.-1.0/02:00:00

Function Documentation

◆ M_mtzfile_tzs_add_file()

M_time_result_t M_mtzfile_tzs_add_file ( M_time_tzs_t tzs,
const char *  path,
size_t *  err_line,
char **  err_sect,
char **  err_data 
)

Add Mstdlib TZ from a file.

Parameters
[in,out]tzsThe tz db.
[in]pathThe file and path to load.
[out]err_lineThe line number if failure is due to ini parse failure.
[out]err_sectThe section that failed to parse if a parse failure not due to an ini parse failure.
[out]err_dataThe data that caused the failure.
Returns
Success on success. Otherwise error condition.

◆ M_mtzfile_tzs_add_str()

M_time_result_t M_mtzfile_tzs_add_str ( M_time_tzs_t tzs,
const char *  data,
size_t *  err_line,
char **  err_sect,
char **  err_data 
)

Add Mstdlib TZ from a string.

Parameters
[in,out]tzsThe tz db.
[in]dataThe data to load.
[out]err_lineThe line number if failure is due to ini parse failure.
[out]err_sectThe section that failed to parse if a parse failure not due to an ini parse failure.
[out]err_dataThe data that caused the failure.
Returns
Success on success. Otherwise error condition.
See also
M_mtzfile_tzs_add_file for details of the format.