00001 /* 00002 * Asterisk -- An open source telephony toolkit. 00003 * 00004 * Copyright (C) 1999 - 2005, Digium, Inc. 00005 * 00006 * Mark Spencer <markster@digium.com> 00007 * Tilghman Lesher <tlesher@vcch.com> 00008 * 00009 * See http://www.asterisk.org for more information about 00010 * the Asterisk project. Please do not directly contact 00011 * any of the maintainers of this project for assistance; 00012 * the project provides a web site, mailing lists and IRC 00013 * channels for your use. 00014 * 00015 * This program is free software, distributed under the terms of 00016 * the GNU General Public License Version 2. See the LICENSE file 00017 * at the top of the source tree. 00018 */ 00019 00020 /*! \file 00021 * \brief Custom localtime functions for multiple timezones 00022 */ 00023 00024 #ifndef _ASTERISK_LOCALTIME_H 00025 #define _ASTERISK_LOCALTIME_H 00026 00027 struct ast_tm { 00028 int tm_sec; /*!< Seconds. [0-60] (1 leap second) */ 00029 int tm_min; /*!< Minutes. [0-59] */ 00030 int tm_hour; /*!< Hours. [0-23] */ 00031 int tm_mday; /*!< Day. [1-31] */ 00032 int tm_mon; /*!< Month. [0-11] */ 00033 int tm_year; /*!< Year - 1900. */ 00034 int tm_wday; /*!< Day of week. [0-6] */ 00035 int tm_yday; /*!< Days in year.[0-365] */ 00036 int tm_isdst; /*!< DST. [-1/0/1]*/ 00037 long int tm_gmtoff; /*!< Seconds east of UTC. */ 00038 char *tm_zone; /*!< Timezone abbreviation. */ 00039 /* NOTE: do NOT reorder this final item. The order needs to remain compatible with struct tm */ 00040 int tm_usec; /*!< microseconds */ 00041 }; 00042 00043 struct ast_tm *ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone); 00044 void ast_get_dst_info(const time_t * const timep, int *dst_enabled, time_t *dst_start, time_t *dst_end, int *gmt_off, const char * const zone); 00045 struct timeval ast_mktime(struct ast_tm * const tmp, const char *zone); 00046 int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm); 00047 00048 #endif /* _ASTERISK_LOCALTIME_H */