Asterisk - The Open Source Telephony Project
18.5.0
|
Custom localtime functions for multiple timezones. More...
#include <locale.h>
Go to the source code of this file.
Data Structures | |
struct | ast_tm |
Macros | |
#define | AST_ISO8601_FORMAT "%FT%T.%q%z" |
ast_strftime for ISO8601 formatting timestamps. More... | |
#define | AST_ISO8601_LEN 29 |
Max length of an null terminated, millisecond resolution, ISO8601 timestamp string. More... | |
Typedefs | |
typedef void * | locale_t |
Functions | |
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 *p_tm, 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 *const 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 *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. More... | |
int | ast_strftime_locale (char *buf, size_t len, const char *format, 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) |
Custom localtime functions for multiple timezones.
Definition in file localtime.h.
#define AST_ISO8601_FORMAT "%FT%T.%q%z" |
ast_strftime for ISO8601 formatting timestamps.
Definition at line 103 of file localtime.h.
Referenced by ast_json_timeval().
#define AST_ISO8601_LEN 29 |
Max length of an null terminated, millisecond resolution, ISO8601 timestamp string.
Definition at line 105 of file localtime.h.
Referenced by ast_json_timeval().
typedef void* locale_t |
Definition at line 32 of file localtime.h.
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(), and NULL.
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(), enc_ie_date(), 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(), mysql_log(), odbc_log(), packdate(), pgsql_log(), phone_call(), 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(), sip_show_registry(), sms_compose2(), sms_handleincoming_proto2(), static_callback(), timeout_write(), transmit_definetimedate(), transmit_notify_request_with_callerid(), 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(), 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(), and time1().
Referenced by acf_strptime(), 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_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(), and NULL.
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(), mysql_log(), odbc_log(), pgsql_log(), prometheus_show_status(), rt_extend_conf(), sendmail(), sendpage(), set_header(), sip_show_registry(), static_callback(), timeout_write(), and write_metadata().
int ast_strftime_locale | ( | char * | buf, |
size_t | len, | ||
const char * | format, | ||
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(), format, 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(), 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(), ast_tm::tm_isdst, and ast_tm::tm_usec.
Referenced by ast_strptime().