Mstdlib-1.24.0
Timezone

Functions

M_time_tzs_tM_time_tzs_create (void)
 
void M_time_tzs_destroy (M_time_tzs_t *tzs)
 
M_time_load_source_t M_time_tzs_load (M_time_tzs_t **tzs, M_uint32 zones, M_uint32 alias_f, M_uint32 flags)
 
M_time_tzs_tM_time_tzs_load_zoneinfo (const char *path, M_uint32 zones, M_uint32 alias_f, M_uint32 flags)
 
M_time_tzs_tM_time_tzs_load_win_zones (M_uint32 zones, M_uint32 alias_f, M_uint32 flags)
 
M_time_result_t M_time_tzs_add_win_zone (M_time_tzs_t *tzs, const char *name)
 
M_time_result_t M_time_tzs_add_posix_str (M_time_tzs_t *tzs, const char *str)
 
M_time_result_t M_time_tzs_add_tzfile (M_time_tzs_t *tzs, const char *path, const char *name)
 
M_list_str_tM_time_tzs_get_loaded_zones (const M_time_tzs_t *tzs)
 
const M_time_tz_tM_time_tzs_get_tz (M_time_tzs_t *tzs, const char *name)
 

Detailed Description

Function Documentation

◆ M_time_tzs_create()

M_time_tzs_t * M_time_tzs_create ( void  )

Create an empty timezone db.

Returns
Time zone db.

◆ M_time_tzs_destroy()

void M_time_tzs_destroy ( M_time_tzs_t tzs)

Destroy a time zone db.

Parameters
[in]tzsTime zone db.

◆ M_time_tzs_load()

M_time_load_source_t M_time_tzs_load ( M_time_tzs_t **  tzs,
M_uint32  zones,
M_uint32  alias_f,
M_uint32  flags 
)

Load default timezones from system available source.

This will attempt to load system timezone data. If that fails, it will fall back to loading the four main US timezones with DST times and without historic data.

  • ET: Eastern
  • CT: Central
  • MT: Mountain
  • PT: Pacific
Parameters
[out]tzsTime zone db.
[in]zonesM_time_tz_zones_t zones. What zones from the db should be loaded.
[in]alias_fM_time_tz_alias_t to handle alias loading.
[in]flagsM_time_tz_load_t flags. How should the data be loaded. Specifically should lazy loading be used. When lazying loading data is read from disk (and cached) on demand. If lazy loading is not used all day is read from disk immediately.
Returns
Source timezone data was loaded from.

◆ M_time_tzs_load_zoneinfo()

M_time_tzs_t * M_time_tzs_load_zoneinfo ( const char *  path,
M_uint32  zones,
M_uint32  alias_f,
M_uint32  flags 
)

Load a tzs with data from a precomputed Olson/TZ/Zoneinfo db.

To prevent possible issues the zoneinfo path cannot be a symlink. If it is a symlink the symlink needs to be resolved before passing into this function. Further, symlinks within the zoneinfo base dir cannot point to locations outside of the base dir.

Parameters
[in]pathThe path to the data to load. On Unix systems this is typically "/usr/share/zoneinfo" or "/usr/lib/zoneinfo". If NULL those two default locations will be checked for zoneinfo.
[in]zonesM_time_tz_zones_t zones. What zones from the db should be loaded.
[in]alias_fM_time_tz_alias_t to handle alias loading.
[in]flagsM_time_tz_load_t flags. How should the data be loaded. Specifically should lazy loading be used. When lazying loading data is read from disk (and cached) on demand. If lazy loading is not used all day is read from disk immediately.
Returns
Time zone db.

◆ M_time_tzs_load_win_zones()

M_time_tzs_t * M_time_tzs_load_win_zones ( M_uint32  zones,
M_uint32  alias_f,
M_uint32  flags 
)

Load a tzs with data from the Windows time zone database.

Windows only.

Parameters
[in]zonesM_time_tz_zones_t zones. What zones from the db should be loaded.
[in]alias_fM_time_tz_alias_t to handle alias loading.
[in]flagsM_time_tz_load_t flags. How should the data be loaded. Specifically should lazy loading be used. When lazying loading data is read from disk (and cached) on demand. If lazy loading is not used all day is read from disk immediately.
Returns
Time zone db.

◆ M_time_tzs_add_win_zone()

M_time_result_t M_time_tzs_add_win_zone ( M_time_tzs_t tzs,
const char *  name 
)

Add data from the Windows time zone database.

Windows only.

Parameters
[in,out]tzsThe tz db.
[in]nameThe info to load. Only the Windows name is supported.
Returns
Success on success. Otherwise error condition.

◆ M_time_tzs_add_posix_str()

M_time_result_t M_time_tzs_add_posix_str ( M_time_tzs_t tzs,
const char *  str 
)

Add the timezone data from a Posix TZ string.

Only the M day of week format is supported for specifying transition day. Example: EST5EDT,M3.2.0/02:00:00,M11.1.0/02:00:00

Parameters
[in,out]tzsThe tz db.
[in]strThe string to parse.
Returns
Success on success. Otherwise error condition.

◆ M_time_tzs_add_tzfile()

M_time_result_t M_time_tzs_add_tzfile ( M_time_tzs_t tzs,
const char *  path,
const char *  name 
)

Add data from a specific TZif file.

Parameters
[in,out]tzsThe tz db.
[in]pathThe file to load.
[in]nameThe name to associate with the file.
Returns
Success on success. Otherwise error condition.

◆ M_time_tzs_get_loaded_zones()

M_list_str_t * M_time_tzs_get_loaded_zones ( const M_time_tzs_t tzs)

Get a list of loaded timezones.

The names are stored case preserving but a lookup is case insensitive.

Parameters
[in]tzsThe tz db.
Returns
A list of names in the db.

◆ M_time_tzs_get_tz()

const M_time_tz_t * M_time_tzs_get_tz ( M_time_tzs_t tzs,
const char *  name 
)

Get a specific tz from the db.

The time zone will be loaded if lazy loading is in use.

Parameters
[in,out]tzsThe tz db.
[in]nameThe name of the tz. The names are looked up case insensitive.
Returns
The tz on success. Otherwise NULL if a tz for the given name was not found.