Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
#include "asterisk.h"
#include <signal.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <float.h>
#include <stdlib.h>
#include <sys/inotify.h>
#include "private.h"
#include "tzfile.h"
#include "asterisk/_private.h"
#include "asterisk/lock.h"
#include "asterisk/localtime.h"
#include "asterisk/strings.h"
#include "asterisk/linkedlists.h"
#include "asterisk/utils.h"
#include "asterisk/test.h"
Go to the source code of this file.
Data Structures | |
struct | locale_entry |
struct | localelist |
struct | lsinfo |
leap second information More... | |
struct | rule |
struct | state |
struct | ttinfo |
time type information More... | |
struct | zonelist |
Macros | |
#define | BIGGEST(a, b) (((a) > (b)) ? (a) : (b)) |
#define | DAY_OF_YEAR 1 /* n - day of year */ |
#define | JULIAN_DAY 0 /* Jn - Julian day */ |
#define | MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */ |
#define | MY_TZNAME_MAX 255 |
#define | OPEN_MODE O_RDONLY |
#define | SP_HEAP_FREE(sp) do {} while (0) |
#define | SP_HEAP_INIT(sp) |
#define | SP_STACK_CHECK(sp) ((sp)->wd[0] == SP_STACK_FLAG) |
#define | SP_STACK_FLAG INT_MIN |
#define | SP_STACK_INIT(sp) |
#define | TZ_ABBR_CHAR_SET "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._" |
#define | TZ_ABBR_ERR_CHAR '_' |
#define | TZ_ABBR_MAX_LEN 16 |
#define | TZ_STRLEN_MAX 255 |
#define | TZDEFRULESTRING ",M4.1.0,M10.5.0" |
Functions | |
static void | add_notify (struct state *sp, const char *path) |
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) |
struct ast_tm * | ast_localtime (const struct timeval *timep, struct ast_tm *tmp, const char *zone) |
Timezone-independent version of localtime_r(3). More... | |
void | ast_localtime_wakeup_monitor (struct ast_test *info) |
struct timeval | ast_mktime (struct ast_tm *tmp, const char *zone) |
Timezone-independent version of mktime(3). More... | |
const char * | ast_setlocale (const char *locale) |
Set the thread-local representation of the current locale. More... | |
int | ast_strftime (char *buf, size_t len, const char *tmp, const struct ast_tm *tm) |
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strftime(3), with the addition of q, which specifies microseconds. More... | |
int | ast_strftime_locale (char *buf, size_t len, const char *tmp, const struct ast_tm *tm, const char *locale) |
char * | ast_strptime (const char *s, const char *format, struct ast_tm *tm) |
Special version of strptime(3) which places the answer in the common structure ast_tm. Also, unlike strptime(3), ast_strptime() initializes its memory prior to use. More... | |
char * | ast_strptime_locale (const char *s, const char *format, struct ast_tm *tm, const char *locale) |
static const struct state * | ast_tzset (const char *zone) |
void | clean_time_zones (void) |
static void | common_startup (void) |
static long | detzcode (const char *const codep) |
static time_t | detzcode64 (const char *const codep) |
static int | differ_by_repeat (const time_t t1, const time_t t0) |
static struct locale_entry * | find_by_locale (locale_t locale) |
static struct locale_entry * | find_by_name (const char *name) |
static const char * | getnum (const char *strp, int *nump, const int min, const int max) |
Given a pointer into a time zone string, extract a number from that string. Check that the number is within a specified range; if it is not, return NULL. Otherwise, return a pointer to the first character not part of the number. More... | |
static const char * | getoffset (const char *strp, long *offsetp) |
Given a pointer into a time zone string, extract an offset, in [+-]hh[:mm[:ss]] form, from the string. If any error occurs, return NULL. Otherwise, return a pointer to the first character not part of the time. More... | |
static const char * | getqzname (const char *strp, const int delim) |
Given a pointer into an extended time zone string, scan until the ending delimiter of the zone name is located. Return a pointer to the delimiter. More... | |
static const char * | getrule (const char *strp, struct rule *rulep) |
Given a pointer into a time zone string, extract a rule in the form date[/time]. See POSIX section 8 for the format of "date" and "time". If a valid rule is not found, return NULL. Otherwise, return a pointer to the first character not part of the rule. More... | |
static const char * | getsecs (const char *strp, long *const secsp) |
Given a pointer into a time zone string, extract a number of seconds, in hh[:mm[:ss]] form, from the string. If any error occurs, return NULL. Otherwise, return a pointer to the first character not part of the number of seconds. More... | |
static const char * | getzname (const char *strp) |
Given a pointer into a time zone string, scan until a character that is not a valid character in a zone name is found. Return a pointer to that character. More... | |
static int | gmtload (struct state *sp) |
static struct ast_tm * | gmtsub (const struct timeval *timep, const long offset, struct ast_tm *tmp) |
static int | increment_overflow (int *number, int delta) |
Simplified normalize logic courtesy Paul Eggert. More... | |
static void * | inotify_daemon (void *data) |
static int | leaps_thru_end_of (const int y) |
Return the number of leap years through the end of the given year where, to make the math easy, the answer for year zero is defined as zero. More... | |
static struct ast_tm * | localsub (const struct timeval *timep, const long offset, struct ast_tm *tmp, const struct state *sp) |
static int | long_increment_overflow (long *number, int delta) |
static int | long_normalize_overflow (long *tensptr, int *unitsptr, const int base) |
static int | normalize_overflow (int *tensptr, int *unitsptr, const int base) |
static long detzcode | P ((const char *codep)) |
static int tzload | P ((const char *name, struct state *sp, int doextend)) |
static int tzparse | P ((const char *name, struct state *sp, int lastditch)) |
static const char *getzname | P ((const char *strp)) |
static const char *getqzname | P ((const char *strp, const int delim)) |
static const char *getnum | P ((const char *strp, int *nump, int min, int max)) |
static const char *getoffset | P ((const char *strp, long *offsetp)) |
static const char *getsecs | P ((const char *strp, long *secsp)) |
static const char *getrule | P ((const char *strp, struct rule *rulep)) |
static int tmcomp | P ((const struct ast_tm *atmp, const struct ast_tm *btmp)) |
static struct ast_tm *timesub | P ((const struct timeval *timep, long offset, const struct state *sp, struct ast_tm *tmp)) |
static struct ast_tm *gmtsub | P ((const struct timeval *timep, long offset, struct ast_tm *tmp)) |
static struct ast_tm *localsub | P ((const struct timeval *timep, long offset, struct ast_tm *tmp, const struct state *sp)) |
static int increment_overflow | P ((int *number, int delta)) |
static int normalize_overflow | P ((int *tensptr, int *unitsptr, const int base)) |
static int leaps_thru_end_of | P ((int y)) |
static int long_increment_overflow | P ((long *number, int delta)) |
static int long_normalize_overflow | P ((long *tensptr, int *unitsptr, const int base)) |
static struct timeval time1 | P ((struct ast_tm *tmp, struct ast_tm *(*funcp) P((const struct timeval *, long, struct ast_tm *, const struct state *sp)), long offset, const struct state *sp)) |
static struct timeval time2 | P ((struct ast_tm *tmp, struct ast_tm *(*funcp) P((const struct timeval *, long, struct ast_tm *, const struct state *sp)), long offset, int *okayp, const struct state *sp)) |
static struct timeval time2sub | P ((struct ast_tm *tmp, struct ast_tm *(*funcp)(const struct timeval *, long, struct ast_tm *, const struct state *sp), long offset, int *okayp, int do_norm_secs, const struct state *sp)) |
static int gmtload | P ((struct state *sp)) |
static time_t transtime | P ((time_t janfirst, int year, const struct rule *rulep, long offset)) |
static int differ_by_repeat | P ((time_t t1, time_t t0)) |
static struct state * | sstate_alloc (void) |
static void | sstate_free (struct state *p) |
static const char * | store_by_locale (locale_t prevlocale) |
static struct timeval | time1 (struct ast_tm *tmp, struct ast_tm *(*const funcp)(const struct timeval *, long, struct ast_tm *, const struct state *), const long offset, const struct state *sp) |
static struct timeval | time2 (struct ast_tm *tmp, struct ast_tm *(*const funcp)(const struct timeval *, long, struct ast_tm *, const struct state *sp), const long offset, int *okayp, const struct state *sp) |
static struct timeval | time2sub (struct ast_tm *tmp, struct ast_tm *(*const funcp)(const struct timeval *, long, struct ast_tm *, const struct state *), const long offset, int *okayp, const int do_norm_secs, const struct state *sp) |
static struct ast_tm * | timesub (const struct timeval *timep, const long offset, const struct state *sp, struct ast_tm *tmp) |
static int | tmcomp (const struct ast_tm *atmp, const struct ast_tm *btmp) |
static time_t | transtime (const time_t janfirst, const int year, const struct rule *rulep, const long offset) |
Given the Epoch-relative time of January 1, 00:00:00 UTC, in a year, the year, a rule, and the offset from UTC at the time that rule takes effect, calculate the Epoch-relative time that rule takes effect. More... | |
static int | tzload (const char *name, struct state *const sp, const int doextend) |
static int | tzparse (const char *name, struct state *sp, const int lastditch) |
Variables | |
static char | elsieid [] = "@(#)localtime.c 8.5" |
static const char | gmt [] = "GMT" |
static ast_cond_t | initialization |
static ast_mutex_t | initialization_lock |
static int | inotify_fd = -1 |
static pthread_t | inotify_thread = AST_PTHREADT_NULL |
static struct localelist | localelist = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , } |
static const int | mon_lengths [2][MONSPERYEAR] |
static const struct timeval | WRONG = { 0, 0 } |
static const int | year_lengths [2] |
static struct zonelist | zonelist = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , } |
Multi-timezone Localtime code
The original source from this file may be obtained from ftp://elsie.nci.nih.gov/pub/
Definition in file localtime.c.
#define DAY_OF_YEAR 1 /* n - day of year */ |
Definition at line 257 of file localtime.c.
#define JULIAN_DAY 0 /* Jn - Julian day */ |
Definition at line 256 of file localtime.c.
#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */ |
Definition at line 258 of file localtime.c.
#define MY_TZNAME_MAX 255 |
Definition at line 152 of file localtime.c.
#define OPEN_MODE O_RDONLY |
Definition at line 107 of file localtime.c.
#define SP_HEAP_FREE | ( | sp | ) | do {} while (0) |
Definition at line 199 of file localtime.c.
#define SP_HEAP_INIT | ( | sp | ) |
Definition at line 195 of file localtime.c.
#define SP_STACK_CHECK | ( | sp | ) | ((sp)->wd[0] == SP_STACK_FLAG) |
Definition at line 194 of file localtime.c.
#define SP_STACK_FLAG INT_MIN |
Definition at line 189 of file localtime.c.
#define SP_STACK_INIT | ( | sp | ) |
Definition at line 191 of file localtime.c.
#define TZ_ABBR_CHAR_SET "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._" |
Definition at line 91 of file localtime.c.
#define TZ_ABBR_ERR_CHAR '_' |
Definition at line 96 of file localtime.c.
#define TZ_ABBR_MAX_LEN 16 |
Definition at line 87 of file localtime.c.
#define TZ_STRLEN_MAX 255 |
Definition at line 155 of file localtime.c.
#define TZDEFRULESTRING ",M4.1.0,M10.5.0" |
Definition at line 128 of file localtime.c.
|
static |
Definition at line 411 of file localtime.c.
References ast_cond_init, ast_cond_wait, ast_mutex_init, ast_mutex_lock, ast_mutex_unlock, ast_pthread_create_background, AST_PTHREADT_NULL, FILENAME_MAX, initialization, initialization_lock, inotify_daemon(), inotify_fd, inotify_thread, NULL, SP_STACK_CHECK, and state::wd.
Referenced by common_startup(), and tzload().
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 | ||
) |
Definition at line 1754 of file localtime.c.
References ast_tzset(), state::ats, AVGSECSPERYEAR, state::goahead, state::goback, int_fast64_t, NULL, state::timecnt, ttinfo::tt_gmtoff, ttinfo::tt_isdst, state::ttis, state::typecnt, state::types, and YEARSPERREPEAT.
Referenced by set_timezone_variables().
struct ast_tm * ast_localtime | ( | const struct timeval * | timep, |
struct ast_tm * | p_tm, | ||
const char * | zone | ||
) |
Timezone-independent version of localtime_r(3).
timep | Current time, including microseconds |
p_tm | Pointer to memory where the broken-out time will be stored |
zone | Text string of a standard system zoneinfo file. If NULL, the system localtime will be used. |
p_tm | is returned for convenience |
Definition at line 1739 of file localtime.c.
References ast_tzset(), localsub(), NULL, and tmp().
Referenced by acf_strftime(), action_corestatus(), append_date(), ast_cel_fabricate_channel_from_event(), ast_check_timing2(), ast_http_send(), ast_json_timeval(), ast_queue_log(), ast_say_date_da(), ast_say_date_de(), ast_say_date_en(), ast_say_date_fr(), ast_say_date_gr(), ast_say_date_he(), ast_say_date_hu(), ast_say_date_is(), ast_say_date_ja(), ast_say_date_ka(), ast_say_date_nl(), ast_say_date_pt(), ast_say_date_th(), ast_say_date_with_format_da(), ast_say_date_with_format_de(), ast_say_date_with_format_en(), ast_say_date_with_format_es(), ast_say_date_with_format_fr(), ast_say_date_with_format_gr(), ast_say_date_with_format_he(), ast_say_date_with_format_is(), ast_say_date_with_format_it(), ast_say_date_with_format_ja(), ast_say_date_with_format_nl(), ast_say_date_with_format_pl(), ast_say_date_with_format_pt(), ast_say_date_with_format_th(), ast_say_date_with_format_vi(), ast_say_date_with_format_zh(), ast_say_datetime_de(), ast_say_datetime_en(), ast_say_datetime_fr(), ast_say_datetime_from_now_en(), ast_say_datetime_from_now_fr(), ast_say_datetime_from_now_he(), ast_say_datetime_from_now_ka(), ast_say_datetime_from_now_pt(), ast_say_datetime_gr(), ast_say_datetime_he(), ast_say_datetime_hu(), ast_say_datetime_ja(), ast_say_datetime_ka(), ast_say_datetime_nl(), ast_say_datetime_pt(), ast_say_datetime_pt_BR(), ast_say_datetime_th(), ast_say_datetime_zh(), ast_say_time_de(), ast_say_time_en(), ast_say_time_fr(), ast_say_time_gr(), ast_say_time_he(), ast_say_time_hu(), ast_say_time_ja(), ast_say_time_ka(), ast_say_time_nl(), ast_say_time_pt(), ast_say_time_pt_BR(), ast_say_time_th(), ast_say_time_zh(), AST_TEST_DEFINE(), beanstalk_put(), build_device(), build_radius_record(), callerid_genmsg(), cdr_get_tv(), cdr_read_callback(), cel_bs_put(), cli_prompt(), cli_show_tasks(), conf_run(), epoch_to_string(), exchangecal_get_events_between(), execute_cb(), find_conf_realtime(), format_log_message_ap(), get_date(), get_ewscal_ids_for(), handle_cli_odbc_show(), handle_cli_test_locales(), handle_minivm_show_stats(), handle_show_settings(), http_callback(), iax2_datetime(), isodate(), leave_voicemail(), main(), make_email_file(), make_logchannel(), manager_log(), mstime(), odbc_log(), packdate(), pgsql_log(), play_message_datetime(), prep_email_sub_vars(), prometheus_show_status(), rt_extend_conf(), say_date_generic(), send_date_time(), send_date_time2(), send_date_time3(), sendmail(), set_header(), set_timezone_variables(), sms_compose2(), sms_handleincoming_proto2(), static_callback(), timeout_write(), vmu_tm(), write_history(), and write_metadata().
void ast_localtime_wakeup_monitor | ( | struct ast_test * | info | ) |
Definition at line 795 of file localtime.c.
References ast_cond_timedwait, AST_LIST_LOCK, AST_LIST_UNLOCK, AST_PTHREADT_NULL, ast_tvnow(), sip_to_pjsip::info(), initialization, inotify_thread, lock, and NULL.
Referenced by AST_TEST_DEFINE().
struct timeval ast_mktime | ( | struct ast_tm *const | tmp, |
const char * | zone | ||
) |
Timezone-independent version of mktime(3).
tmp | Current broken-out time, including microseconds |
zone | Text string of a standard system zoneinfo file. If NULL, the system localtime will be used. |
A | structure containing both seconds and fractional thereof since January 1st, 1970 UTC |
Definition at line 2357 of file localtime.c.
References ast_tzset(), localsub(), time1(), tmp(), and WRONG.
Referenced by acf_strptime(), add_cert_expiration_to_astdb(), check_date_header(), conf_run(), find_conf_realtime(), icalfloat_to_timet(), mstime_to_time_t(), rt_extend_conf(), sms_handleincoming_proto2(), sms_readfile(), testtime_write(), and unpackdate().
const char * ast_setlocale | ( | const char * | locale | ) |
Set the thread-local representation of the current locale.
Definition at line 2420 of file localtime.c.
References ast_calloc, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, find_by_name(), locale_entry::list, locale, locale_entry::locale, locale_entry::name, NULL, and store_by_locale().
Referenced by ast_strftime_locale(), ast_strptime_locale(), and handle_cli_test_locales().
int ast_strftime | ( | char * | buf, |
size_t | len, | ||
const char * | format, | ||
const struct ast_tm * | tm | ||
) |
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strftime(3), with the addition of q, which specifies microseconds.
buf | Address in memory where the resulting string will be stored. |
len | Size of the chunk of memory buf. |
format | A string specifying the format of time to be placed into buf. |
tm | Pointer to the broken out time to be used for the format. |
An | integer value specifying the number of bytes placed into buf or -1 on error. |
Definition at line 2524 of file localtime.c.
References ast_strftime_locale(), buf, len(), NULL, and tmp().
Referenced by acf_strftime(), action_corestatus(), append_date(), ast_cel_fabricate_channel_from_event(), ast_http_send(), ast_json_timeval(), ast_queue_log(), beanstalk_put(), build_radius_record(), cdr_get_tv(), cdr_read_callback(), cel_bs_put(), cli_prompt(), cli_show_tasks(), conf_run(), dump_datetime(), epoch_to_string(), exchangecal_get_events_between(), execute_cb(), find_conf_realtime(), format_log_message_ap(), get_date(), get_ewscal_ids_for(), handle_cli_odbc_show(), handle_cli_test_locales(), handle_minivm_show_stats(), handle_show_settings(), http_callback(), isodate(), leave_voicemail(), make_email_file(), make_logchannel(), manager_log(), mstime(), odbc_log(), pgsql_log(), prometheus_show_status(), rt_extend_conf(), sendmail(), sendpage(), set_header(), static_callback(), timeout_write(), and write_metadata().
int ast_strftime_locale | ( | char * | buf, |
size_t | len, | ||
const char * | tmp, | ||
const struct ast_tm * | tm, | ||
const char * | locale | ||
) |
Definition at line 2452 of file localtime.c.
References ast_calloc, ast_free, ast_realloc, ast_setlocale(), buf, len(), locale, ast_tm::tm_usec, and tmp().
Referenced by ast_strftime(), make_email_file(), prep_email_sub_vars(), and sendpage().
char * ast_strptime | ( | const char * | s, |
const char * | format, | ||
struct ast_tm * | tm | ||
) |
Special version of strptime(3) which places the answer in the common structure ast_tm. Also, unlike strptime(3), ast_strptime() initializes its memory prior to use.
s | A string specifying some portion of a date and time. |
format | The format in which the string, s, is expected. |
tm | The broken-out time structure into which the parsed data is expected. |
A | pointer to the first character within s not used to parse the date and time. |
Definition at line 2550 of file localtime.c.
References ast_strptime_locale(), and NULL.
Referenced by acf_strptime(), add_cert_expiration_to_astdb(), check_date_header(), conf_run(), find_conf_realtime(), mstime_to_time_t(), rt_extend_conf(), and testtime_write().
char * ast_strptime_locale | ( | const char * | s, |
const char * | format, | ||
struct ast_tm * | tm, | ||
const char * | locale | ||
) |
Definition at line 2529 of file localtime.c.
References ast_setlocale(), locale, ast_tm::tm_isdst, and ast_tm::tm_usec.
Referenced by ast_strptime().
|
static |
Definition at line 1601 of file localtime.c.
References ast_copy_string(), AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero(), FALSE, gmtload(), state::list, state::name, NULL, sstate_alloc(), TRUE, tzload(), and tzparse().
Referenced by ast_get_dst_info(), ast_localtime(), and ast_mktime().
void clean_time_zones | ( | void | ) |
Provided by localtime.c
Definition at line 1590 of file localtime.c.
References AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, state::list, and sstate_free().
Referenced by really_quit().
|
static |
Start a notification for every entry already in the list.
Definition at line 328 of file localtime.c.
References add_notify(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, FILENAME_MAX, state::list, name, state::name, TZDEFAULT, and TZDIR.
Referenced by inotify_daemon().
|
static |
Definition at line 822 of file localtime.c.
References result.
Referenced by tzload().
|
static |
Definition at line 833 of file localtime.c.
References int_fast64_t, and result.
Referenced by tzload().
|
static |
Definition at line 844 of file localtime.c.
References SECSPERREPEAT, SECSPERREPEAT_BITS, TYPE_BIT, TYPE_INTEGRAL, and TYPE_SIGNED.
Referenced by tzload().
|
static |
Definition at line 2366 of file localtime.c.
References AST_LIST_TRAVERSE, locale_entry::list, locale, locale_entry::locale, and NULL.
Referenced by store_by_locale().
|
static |
Definition at line 2377 of file localtime.c.
References AST_LIST_TRAVERSE, locale_entry::list, locale_entry::name, name, and NULL.
Referenced by ast_setlocale(), and store_by_locale().
|
static |
Given a pointer into a time zone string, extract a number from that string. Check that the number is within a specified range; if it is not, return NULL. Otherwise, return a pointer to the first character not part of the number.
Definition at line 1153 of file localtime.c.
|
static |
Given a pointer into a time zone string, extract an offset, in [+-]hh[:mm[:ss]] form, from the string. If any error occurs, return NULL. Otherwise, return a pointer to the first character not part of the time.
Definition at line 1220 of file localtime.c.
References getsecs(), and NULL.
Referenced by tzparse().
|
static |
Given a pointer into an extended time zone string, scan until the ending delimiter of the zone name is located. Return a pointer to the delimiter.
As with getzname above, the legal character set is actually quite restricted, with other characters producing undefined results. We don't do any checking here; checking is done later in common-case code.
Definition at line 1137 of file localtime.c.
References c.
Referenced by tzparse().
|
static |
Given a pointer into a time zone string, extract a rule in the form date[/time]. See POSIX section 8 for the format of "date" and "time". If a valid rule is not found, return NULL. Otherwise, return a pointer to the first character not part of the rule.
Definition at line 1244 of file localtime.c.
References DAY_OF_YEAR, DAYSPERLYEAR, DAYSPERNYEAR, DAYSPERWEEK, getnum(), getsecs(), is_digit, JULIAN_DAY, MONSPERYEAR, MONTH_NTH_DAY_OF_WEEK, NULL, rule::r_day, rule::r_mon, rule::r_time, rule::r_type, rule::r_week, and SECSPERHOUR.
Referenced by tzparse().
|
static |
Given a pointer into a time zone string, extract a number of seconds, in hh[:mm[:ss]] form, from the string. If any error occurs, return NULL. Otherwise, return a pointer to the first character not part of the number of seconds.
Definition at line 1181 of file localtime.c.
References DAYSPERWEEK, getnum(), HOURSPERDAY, MINSPERHOUR, NULL, SECSPERHOUR, and SECSPERMIN.
Referenced by getoffset(), and getrule().
|
static |
Given a pointer into a time zone string, scan until a character that is not a valid character in a zone name is found. Return a pointer to that character.
Definition at line 1118 of file localtime.c.
Referenced by tzparse().
|
static |
|
static |
Definition at line 1866 of file localtime.c.
References AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, state::chars, gmtload(), state::list, state::name, NULL, result, sstate_alloc(), timesub(), and tmp().
Referenced by localsub().
|
static |
Simplified normalize logic courtesy Paul Eggert.
Definition at line 2051 of file localtime.c.
Referenced by normalize_overflow(), time2sub(), and timesub().
|
static |
Definition at line 353 of file localtime.c.
References ast_alloca, ast_cond_broadcast, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_log, ast_mutex_lock, ast_mutex_unlock, AST_PTHREADT_NULL, common_startup(), errno, FILENAME_MAX, initialization, initialization_lock, inotify_fd, inotify_thread, state::list, LOG_ERROR, NULL, sstate_free(), and state::wd.
Referenced by add_notify().
|
static |
Return the number of leap years through the end of the given year where, to make the math easy, the answer for year zero is defined as zero.
Definition at line 1907 of file localtime.c.
References leaps_thru_end_of().
Referenced by leaps_thru_end_of(), and timesub().
|
static |
The unused offset argument is for the benefit of mktime variants.
Definition at line 1648 of file localtime.c.
References state::ats, AVGSECSPERYEAR, state::chars, gmtsub(), state::goahead, state::goback, int_fast64_t, localsub(), NULL, result, state::timecnt, timesub(), tmp(), ttinfo::tt_abbrind, ttinfo::tt_gmtoff, ttinfo::tt_isdst, state::ttis, state::typecnt, state::types, and YEARSPERREPEAT.
Referenced by ast_localtime(), ast_mktime(), and localsub().
|
static |
Definition at line 2060 of file localtime.c.
Referenced by long_normalize_overflow(), and time2sub().
|
static |
Definition at line 2080 of file localtime.c.
References long_increment_overflow().
Referenced by time2sub().
|
static |
Definition at line 2069 of file localtime.c.
References increment_overflow().
Referenced by time2sub().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 778 of file localtime.c.
References ast_calloc, NULL, and SP_HEAP_INIT.
Referenced by ast_tzset(), and gmtsub().
|
static |
Definition at line 789 of file localtime.c.
References ast_free, and SP_HEAP_FREE.
Referenced by clean_time_zones(), and inotify_daemon().
|
static |
Definition at line 2388 of file localtime.c.
References ast_calloc, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, find_by_locale(), find_by_name(), locale_entry::list, locale_entry::locale, locale_entry::name, name, and NULL.
Referenced by ast_setlocale().
|
static |
Definition at line 2292 of file localtime.c.
References FALSE, NULL, time2(), state::timecnt, tmp(), TRUE, ttinfo::tt_gmtoff, ttinfo::tt_isdst, state::ttis, state::typecnt, state::types, TZ_MAX_TYPES, and WRONG.
Referenced by ast_mktime().
|
static |
Definition at line 2279 of file localtime.c.
References FALSE, time2sub(), tmp(), and TRUE.
Referenced by time1().
|
static |
Definition at line 2105 of file localtime.c.
References DAYSPERLYEAR, EPOCH_YEAR, FALSE, HOURSPERDAY, increment_overflow(), isleap, long_increment_overflow(), long_normalize_overflow(), MINSPERHOUR, mon_lengths, MONSPERYEAR, normalize_overflow(), NULL, SECSPERMIN, ast_tm::tm_hour, ast_tm::tm_isdst, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_year, TM_YEAR_BASE, tmcomp(), tmp(), TRUE, ttinfo::tt_gmtoff, ttinfo::tt_isdst, state::ttis, TYPE_BIT, TYPE_INTEGRAL, TYPE_SIGNED, state::typecnt, WRONG, and year_lengths.
Referenced by time2().
|
static |
Definition at line 1913 of file localtime.c.
References DAYSPERLYEAR, DAYSPERNYEAR, DAYSPERWEEK, EPOCH_WDAY, EPOCH_YEAR, increment_overflow(), isleap, state::leapcnt, leaps_thru_end_of(), lsinfo::ls_corr, lsinfo::ls_trans, state::lsis, mon_lengths, NULL, SECSPERDAY, SECSPERHOUR, SECSPERMIN, TM_YEAR_BASE, tmp(), while(), and year_lengths.
Referenced by gmtsub(), and localsub().
Definition at line 2091 of file localtime.c.
References result, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, ast_tm::tm_sec, ast_tm::tm_usec, and ast_tm::tm_year.
Referenced by time2sub().
|
static |
Given the Epoch-relative time of January 1, 00:00:00 UTC, in a year, the year, a rule, and the offset from UTC at the time that rule takes effect, calculate the Epoch-relative time that rule takes effect.
Definition at line 1295 of file localtime.c.
References d, DAY_OF_YEAR, DAYSPERWEEK, INITIALIZE, isleap, JULIAN_DAY, mon_lengths, MONTH_NTH_DAY_OF_WEEK, rule::r_day, rule::r_mon, rule::r_time, rule::r_type, rule::r_week, SECSPERDAY, and value.
Referenced by tzparse().
|
static |
Definition at line 853 of file localtime.c.
References add_notify(), ast_fully_booted, state::ats, buf, state::charcnt, state::chars, detzcode(), detzcode64(), differ_by_repeat(), FALSE, FILENAME_MAX, state::goahead, state::goback, if(), state::leapcnt, lsinfo::ls_corr, lsinfo::ls_trans, state::lsis, name, NULL, OPEN_MODE, result, SP_STACK_INIT, state::timecnt, TRUE, ttinfo::tt_abbrind, ttinfo::tt_gmtoff, ttinfo::tt_isdst, ttinfo::tt_ttisgmt, ttinfo::tt_ttisstd, state::ttis, TYPE_INTEGRAL, TYPE_SIGNED, state::typecnt, state::types, TZ_MAX_CHARS, TZ_MAX_LEAPS, TZ_MAX_TIMES, TZ_MAX_TYPES, TZDEFAULT, TZDIR, tzparse(), while(), and YEARSPERREPEAT.
Referenced by ast_tzset(), gmtload(), and tzparse().
|
static |
Definition at line 1385 of file localtime.c.
References state::ats, state::charcnt, state::chars, end, EPOCH_YEAR, FALSE, getoffset(), getqzname(), getrule(), getzname(), INITIALIZE, isleap, state::leapcnt, name, NULL, SECSPERDAY, SECSPERHOUR, state::timecnt, transtime(), TRUE, ttinfo::tt_abbrind, ttinfo::tt_gmtoff, ttinfo::tt_isdst, ttinfo::tt_ttisgmt, state::ttis, state::typecnt, state::types, TZ_MAX_TIMES, TZDEFRULES, TZDEFRULESTRING, tzload(), and year_lengths.
Referenced by ast_tzset(), gmtload(), and tzload().
|
static |
Definition at line 82 of file localtime.c.
|
static |
Definition at line 110 of file localtime.c.
Referenced by gmtload().
|
static |
Definition at line 322 of file localtime.c.
Referenced by add_notify(), ast_localtime_wakeup_monitor(), and inotify_daemon().
|
static |
Definition at line 323 of file localtime.c.
Referenced by add_notify(), and inotify_daemon().
|
static |
Definition at line 351 of file localtime.c.
Referenced by add_notify(), inotify_daemon(), and scan_thread().
|
static |
Definition at line 321 of file localtime.c.
Referenced by add_notify(), ast_localtime_wakeup_monitor(), and inotify_daemon().
|
static |
|
static |
Definition at line 1103 of file localtime.c.
Referenced by time2sub(), timesub(), and transtime().
|
static |
Definition at line 111 of file localtime.c.
Referenced by ast_mktime(), time1(), and time2sub().
|
static |
Definition at line 1108 of file localtime.c.
Referenced by time2sub(), timesub(), and tzparse().