Main Page | Modules | Data Structures | Data Fields

Time zone


Detailed Description

Although it might look a bit off-topic, in order to provide a minimal but good time/date interface, the peak library is able to handle time zone conversion. Thanks to its design, time/date operations are efficient and a lack of time zone support would add unnecessary overhead in application's code.


Typedefs

typedef __peak_tz * peak_tz
 Opaque time zone pointer type.


Functions

peak_tz peak_tz_create (const char *tz_name)
 Create a time zone object with a name.

peak_tz peak_tz_create_system (void)
 Create a time zone object with current system settings.

const char * peak_tz_get_name (peak_tz tz)
 Get time zone's name.

const char * peak_tz_get_abbreviation (peak_tz tz, time_t t)
 Get time zone's abbreviation at the specified date.

time_t peak_tz_get_gmt_offset (peak_tz tz, time_t t)
 Get time zone's GMT offset at a specified date.

int peak_tz_is_dst (peak_tz tz, time_t t)
 Returns whether or not a time zone is in daylight savings time at a specified date.


Function Documentation

peak_tz peak_tz_create const char *  tz_name  ) 
 

Create a time zone object with a name.

Parameters:
tz_name Pathname of a tzfile(5)-format file from which to read the conversion information. If the first character of the pathname is a slash (`/') it is used as an absolute pathname; otherwise, it is used as a pathname relative to the system time conversion information directory (often /usr/share/zoneinfo).
Returns:
New time zone reference (use peak_release() when you don't need it anymore) or NULL if the time zone file cannot be found or another misc issue is encountered.

peak_tz peak_tz_create_system void   ) 
 

Create a time zone object with current system settings.

Returns:
The system's time zone reference, possibly a reference to the UTC time zone if the library doesn't understand the system's configuration or if a system's misconfiguration is encountered. Finally returns NULL if both attempts failed.

const char* peak_tz_get_abbreviation peak_tz  tz,
time_t  t
 

Get time zone's abbreviation at the specified date.

Parameters:
tz The time zone reference.
t Unix time. It is required as the abbreviation may be different at different dates (eg. EDT/EST, NZDT/NZST, etc.). Use peak_time() if you want the current abbreviation.
Returns:
A pointer to a constant string of the abbreviation of the time zone tz. The string is owned by the library so don't release it and copy it if you need it for a long time.

time_t peak_tz_get_gmt_offset peak_tz  tz,
time_t  t
 

Get time zone's GMT offset at a specified date.

Parameters:
tz The time zone reference.
t Unix time. It is required as the offset may be different at different dates. Use peak_time() if you want the current seconds from GMT.
Returns:
The time interval from GMT in second.

const char* peak_tz_get_name peak_tz  tz  ) 
 

Get time zone's name.

Parameters:
tz The time zone reference.
Returns:
A pointer to a constant string of the name of the time zone tz. The string is owned by the library so don't release it and copy it if you need it for a long time.

int peak_tz_is_dst peak_tz  tz,
time_t  t
 

Returns whether or not a time zone is in daylight savings time at a specified date.

Parameters:
tz The time zone reference.
t Unix time's date for which you want to know if the time zone is in daylight savings time.
Return values:
0 Normal period.
1 Daylight Savings Time (DST) period.


Generated on Thu Jan 8 18:16:24 2004 for the PEAK Library by doxygen     SourceForge.net Logo