Time-related functions and macros. More...


Go to the source code of this file.
Functions | |
| struct timeval | ast_samp2tv (unsigned int _nsamp, unsigned int _rate) |
| Returns a timeval corresponding to the duration of n samples at rate r. Useful to convert samples to timevals, or even milliseconds to timevals in the form ast_samp2tv(milliseconds, 1000) | |
| struct timeval | ast_tv (ast_time_t sec, ast_suseconds_t usec) |
| Returns a timeval from sec, usec. | |
| struct timeval | ast_tvadd (struct timeval a, struct timeval b) |
| Returns the sum of two timevals a + b. | |
| int | ast_tvcmp (struct timeval _a, struct timeval _b) |
Compres two struct timeval instances returning. | |
| int64_t | ast_tvdiff_ms (struct timeval end, struct timeval start) |
Computes the difference (in milliseconds) between two struct timeval instances. | |
| int64_t | ast_tvdiff_sec (struct timeval end, struct timeval start) |
Computes the difference (in seconds) between two struct timeval instances. | |
| int64_t | ast_tvdiff_us (struct timeval end, struct timeval start) |
Computes the difference (in microseconds) between two struct timeval instances. | |
| int | ast_tveq (struct timeval _a, struct timeval _b) |
Returns true if the two struct timeval arguments are equal. | |
| struct timeval | ast_tvnow (void) |
| Returns current timeval. Meant to replace calls to gettimeofday(). | |
| struct timeval | ast_tvsub (struct timeval a, struct timeval b) |
| Returns the difference of two timevals a - b. | |
| int | ast_tvzero (const struct timeval t) |
| Returns true if the argument is 0,0. | |
| typedef | typeof (tv.tv_sec) ast_time_t |
Variables | |
| struct timeval | tv |
Time-related functions and macros.
Definition in file time.h.
| struct timeval ast_samp2tv | ( | unsigned int | _nsamp, |
| unsigned int | _rate | ||
| ) | [read] |
Returns a timeval corresponding to the duration of n samples at rate r. Useful to convert samples to timevals, or even milliseconds to timevals in the form ast_samp2tv(milliseconds, 1000)
Definition at line 176 of file time.h.
Referenced by jb_get_and_deliver(), conf_run(), sla_process_timers(), mp3_exec(), NBScat_exec(), mb_poll_thread(), ast_audiohook_trigger_wait(), do_cdr(), agent_hangup(), __get_from_jb(), schedule_delivery(), calc_timestamp(), calc_rxstamp(), iax2_process_thread(), ast_generic_bridge(), ast_channel_bridge(), ast_smoother_read(), monmp3thread(), process_dtmf_rfc2833(), ast_rtp_read(), sched_run(), sched_settime(), cli_tps_ping(), and ast_translate().
| struct timeval ast_tv | ( | ast_time_t | sec, |
| ast_suseconds_t | usec | ||
| ) | [read] |
Returns a timeval from sec, usec.
Definition at line 164 of file time.h.
Referenced by ast_cdr_merge(), agent_request(), login_exec(), __dahdi_exception(), dahdi_read(), schedule_delivery(), misdn_read(), do_immediate_setup(), cb_events(), phone_exception(), phone_read(), do_monitor(), ast_poll2(), acf_jabberreceive_read(), ast_rtp_dtmf_begin(), ast_rtp_dtmf_end_with_duration(), process_dtmf_rfc2833(), ast_rtp_read(), ast_rtp_sendcng(), msg_timestamp(), smdi_message_wait(), mwi_monitor_handler(), pthread_timer_set_rate(), do_timing(), ast_sched_add_variable(), ast_sched_runq(), analog_exception(), pri_dchannel(), ast_translator_build_path(), and ast_translate().
{
| struct timeval ast_tvadd | ( | struct timeval | a, |
| struct timeval | b | ||
| ) | [read] |
Returns the sum of two timevals a + b.
Definition at line 1401 of file utils.c.
References tvfix(), and ONE_MILLION.
Referenced by jb_get_and_deliver(), dial_exec_full(), conf_run(), sla_process_timers(), mp3_exec(), NBScat_exec(), mb_poll_thread(), ast_audiohook_trigger_wait(), do_cdr(), agent_hangup(), __get_from_jb(), schedule_delivery(), calc_timestamp(), iax2_process_thread(), ast_channel_setwhentohangup_tv(), ast_channel_cmpwhentohangup_tv(), ast_generic_bridge(), ast_channel_bridge(), ast_smoother_read(), timeout_write(), ast_poll2(), acf_jabberreceive_read(), monmp3thread(), ast_rtp_dtmf_begin(), ast_rtp_dtmf_end_with_duration(), calc_rxstamp(), ast_rtp_sendcng(), smdi_message_wait(), mwi_monitor_handler(), do_timing(), sched_run(), sched_settime(), ast_sched_runq(), cli_tps_ping(), and ast_translate().
{
/* consistency checks to guarantee usec in 0..999999 */
a = tvfix(a);
b = tvfix(b);
a.tv_sec += b.tv_sec;
a.tv_usec += b.tv_usec;
if (a.tv_usec >= ONE_MILLION) {
a.tv_sec++;
a.tv_usec -= ONE_MILLION;
}
return a;
}
| int ast_tvcmp | ( | struct timeval | _a, |
| struct timeval | _b | ||
| ) | [inline] |
Compres two struct timeval instances returning.
-1, 0, 1 if the first arg is smaller, equal or greater to the second.
Definition at line 119 of file time.h.
Referenced by ast_cdr_merge(), find_cache(), ast_waitfor_nandfds(), ast_bridge_call(), create_dtmf_frame(), sched_time_cmp(), sched_settime(), ast_sched_runq(), and pri_dchannel().
{
| int64_t ast_tvdiff_ms | ( | struct timeval | end, |
| struct timeval | start | ||
| ) | [inline] |
Computes the difference (in milliseconds) between two struct timeval instances.
| end | end of the time period |
| start | beginning of the time period |
Definition at line 89 of file time.h.
Referenced by get_now(), receive_dtmf_digits(), disa_exec(), conf_run(), sla_check_failed_station(), sla_check_station_delay(), sla_calc_trunk_timeouts(), sla_calc_station_timeouts(), mp3_exec(), NBScat_exec(), rpt(), speech_background(), background_detect_exec(), measurenoise(), waituntil_exec(), ast_audiohook_write_frame(), audiohook_read_frame_both(), ast_cdr_getvar(), agent_cont_sleep(), login_exec(), dahdi_handle_event(), dahdi_read(), update_jbsched(), __get_from_jb(), calc_txpeerstamp(), fix_peerts(), calc_timestamp(), calc_rxstamp(), misdn_overlap_dial_task(), misdn_read(), setformat(), retrans_pkt(), show_chanstats_cb(), handle_response_peerpoke(), ast_check_hangup(), ast_channel_cmpwhentohangup_tv(), ast_waitfor_nandfds(), should_skip_dtmf(), __ast_read(), ast_generic_bridge(), ast_channel_bridge(), handle_chanlist(), handle_timeout_trip(), ast_get_enum(), feature_request_and_dial(), ast_bridge_call(), manage_parked_call(), timeout_read(), action_coreshowchannels(), dundi_do_lookup(), dundi_do_precache(), destroy_trans(), dundi_lookup_internal(), dundi_precache_internal(), dundi_query_eid_internal(), purge_old_fn(), ast_poll2(), handle_recordfile(), handle_cli_file_convert(), acf_jabberreceive_read(), monmp3thread(), calc_txstamp(), process_dtmf_rfc2833(), ast_rtp_read(), purge_old_messages(), smdi_message_wait(), check_timer(), ast_sched_wait(), __analog_ss_thread(), __analog_handle_event(), pri_dchannel(), timing_test(), ast_wait_for_output(), ast_carefulwrite(), and ast_careful_fwrite().
{
| int64_t ast_tvdiff_sec | ( | struct timeval | end, |
| struct timeval | start | ||
| ) | [inline] |
Computes the difference (in seconds) between two struct timeval instances.
| end | the end of the time period |
| start | the beginning of the time period |
Definition at line 56 of file time.h.
Referenced by transmit_audio(), transmit_t38(), purge_events(), acf_jabberreceive_read(), delete_old_messages(), and _ast_odbc_request_obj2().
{
| int64_t ast_tvdiff_us | ( | struct timeval | end, |
| struct timeval | start | ||
| ) | [inline] |
Computes the difference (in microseconds) between two struct timeval instances.
| end | the end of the time period |
| start | the beginning of the time period |
Definition at line 70 of file time.h.
Referenced by transmit_t38(), odbc_log(), execute_cb(), pgsql_log(), sqlite_log(), tds_log(), cdr_read(), and ast_merge_contexts_and_delete().
{
| int ast_tveq | ( | struct timeval | _a, |
| struct timeval | _b | ||
| ) | [inline] |
Returns true if the two struct timeval arguments are equal.
Definition at line 129 of file time.h.
Referenced by ast_translate().
{
| struct timeval ast_tvnow | ( | void | ) | [read] |
Returns current timeval. Meant to replace calls to gettimeofday().
Definition at line 141 of file time.h.
Referenced by receive_dtmf_digits(), write_metadata(), wait_for_answer(), dial_exec_full(), disa_exec(), serialize_showchan(), transmit_audio(), transmit_t38(), rt_extend_conf(), conf_run(), find_conf_realtime(), sla_create_ringing_station(), sla_check_failed_station(), sla_ring_station(), sla_check_station_delay(), sla_calc_trunk_timeouts(), sla_calc_station_timeouts(), sla_process_timers(), queue_ringing_trunk(), get_date(), sendmail(), leave_voicemail(), load_config(), mp3_exec(), NBScat_exec(), rpt(), sms_readfile(), sms_writefile(), sms_handleincoming(), sms_handleincoming_proto2(), speech_background(), background_detect_exec(), measurenoise(), vmu_tm(), play_message_datetime(), mb_poll_thread(), waituntil_exec(), cli_prompt(), canary_thread(), main(), ast_audiohook_write_frame(), audiohook_read_frame_both(), ast_audiohook_trigger_wait(), callerid_genmsg(), ast_cdr_getvar(), ast_cdr_start(), ast_cdr_answer(), ast_cdr_end(), do_cdr(), ast_cel_report_event(), add_agent(), agent_hangup(), agent_cont_sleep(), agent_request(), login_exec(), dahdi_handle_event(), __dahdi_exception(), dahdi_read(), handle_cli_iax2_show_cache(), update_jbsched(), __get_from_jb(), iax2_datetime(), iax2_bridge(), fix_peerts(), calc_timestamp(), calc_rxstamp(), find_tpeer(), iax2_trunk_queue(), timing_read(), socket_process_meta(), iax2_process_thread(), find_cache(), mgcp_postrequest(), transmit_notify_request_with_callerid(), misdn_overlap_dial_task(), misdn_read(), cb_events(), setformat(), store_config(), phone_call(), retrans_pkt(), __sip_reliable_xmit(), show_chanstats_cb(), handle_response_register(), handle_response_peerpoke(), sip_poke_peer(), transmit_definetimedate(), get_tick_count(), send_date_time(), send_date_time2(), send_date_time3(), write_history(), build_device(), ast_check_hangup(), ast_channel_setwhentohangup_tv(), ast_channel_cmpwhentohangup_tv(), ast_waitfor_nandfds(), should_skip_dtmf(), __ast_read(), ast_generic_bridge(), ast_channel_bridge(), handle_showuptime(), handle_showcalls(), handle_chanlist(), handle_showchan(), process_text_line(), handle_timeout_trip(), monitor_dial(), ast_get_enum(), park_call_full(), feature_request_and_dial(), ast_bridge_call(), manage_parked_call(), cdr_read(), acf_strftime(), timeout_read(), timeout_write(), ast_http_send(), ast_module_reload(), __ast_rwlock_timedrdlock(), __ast_rwlock_timedwrlock(), ast_queue_log(), ast_log(), __ast_verbose_ap(), purge_events(), authenticate(), action_ping(), action_status(), action_coreshowchannels(), append_event(), __ast_manager_event_multichan(), ast_merge_contexts_and_delete(), ast_check_timing(), pbx_builtin_gotoiftime(), dundi_do_lookup(), dundi_do_precache(), create_transaction(), destroy_trans(), dundi_lookup_internal(), dundi_precache_internal(), dundi_query_eid_internal(), qualify_peer(), cleanup(), realtime_common(), ast_poll2(), handle_recordfile(), calendar_busy_callback(), calendar_devstate_change(), schedule_calendar_event(), calendar_write_exec(), do_refresh(), update_caldav(), caldav_load_calendar(), get_ewscal_ids_for(), ewscal_load_calendar(), update_exchangecal(), exchangecal_load_calendar(), ical_load_calendar(), handle_cli_file_convert(), debug_check_frame_for_silence(), generic_fax_exec(), acf_jabberreceive_read(), delete_old_messages(), aji_handle_message(), monmp3thread(), ast_odbc_prepare_and_execute(), ast_odbc_smart_execute(), _ast_odbc_request_obj2(), odbc_obj_connect(), ast_rtp_dtmf_begin(), ast_rtp_dtmf_end_with_duration(), calc_txstamp(), create_dtmf_frame(), ast_rtp_sendcng(), purge_old_messages(), smdi_message_wait(), smdi_read(), mwi_monitor_handler(), pthread_timer_set_rate(), check_timer(), do_timing(), ast_say_date_with_format_en(), ast_say_date_with_format_da(), ast_say_date_with_format_de(), ast_say_date_with_format_th(), ast_say_date_with_format_he(), ast_say_date_with_format_es(), ast_say_date_with_format_fr(), ast_say_date_with_format_it(), ast_say_date_with_format_nl(), ast_say_date_with_format_pl(), ast_say_date_with_format_pt(), ast_say_date_with_format_zh(), ast_say_datetime_from_now_en(), ast_say_datetime_from_now_fr(), ast_say_datetime_from_now_pt(), ast_say_datetime_from_now_he(), ast_say_date_with_format_gr(), ast_say_date_with_format_vi(), ast_say_datetime_from_now_ka(), sched_run(), ast_sched_wait(), sched_settime(), ast_sched_dump(), ast_sched_runq(), ast_sched_when(), alloc_event(), analog_call(), __analog_ss_thread(), __analog_handle_event(), pri_dchannel(), ss7_linkset(), cli_tps_ping(), timing_test(), ast_translate(), ast_wait_for_output(), ast_carefulwrite(), and ast_careful_fwrite().
{
| struct timeval ast_tvsub | ( | struct timeval | a, |
| struct timeval | b | ||
| ) | [read] |
Returns the difference of two timevals a - b.
Definition at line 1415 of file utils.c.
References tvfix(), and ONE_MILLION.
Referenced by conf_run(), calc_timestamp(), calc_rxstamp(), ast_waitfor_nandfds(), ast_channel_bridge(), handle_showuptime(), handle_showcalls(), __ast_rwlock_timedrdlock(), __ast_rwlock_timedwrlock(), ast_poll2(), debug_check_frame_for_silence(), ast_sched_dump(), pri_dchannel(), cli_tps_ping(), and ast_translate().
{
/* consistency checks to guarantee usec in 0..999999 */
a = tvfix(a);
b = tvfix(b);
a.tv_sec -= b.tv_sec;
a.tv_usec -= b.tv_usec;
if (a.tv_usec < 0) {
a.tv_sec-- ;
a.tv_usec += ONE_MILLION;
}
return a;
}
| int ast_tvzero | ( | const struct timeval | t | ) | [inline] |
Returns true if the argument is 0,0.
Definition at line 99 of file time.h.
Referenced by ast_var_channels_table(), dial_exec_full(), ast_cdr_fork(), conf_run(), sms_writefile(), ast_cdr_merge(), ast_cdr_answer(), ast_cdr_end(), odbc_log(), append_date(), execute_cb(), pgsql_log(), sqlite_log(), tds_log(), get_date(), schedule_delivery(), iax2_bridge(), calc_txpeerstamp(), fix_peerts(), calc_timestamp(), calc_rxstamp(), socket_process_meta(), misdn_read(), do_monitor(), show_chanstats_cb(), ast_check_hangup(), ast_channel_setwhentohangup_tv(), ast_channel_cmpwhentohangup_tv(), ast_waitfor_nandfds(), should_skip_dtmf(), __ast_read(), ast_generic_bridge(), ast_channel_bridge(), handle_chanlist(), ast_bridge_call(), smoother_frame_feed(), ast_smoother_read(), cdr_read(), timeout_read(), timeout_write(), action_coreshowchannels(), monmp3thread(), calc_txstamp(), ast_rtp_raw_write(), sched_settime(), and ast_translate().
{
| typedef typeof | ( | tv. | tv_sec | ) |
| struct timeval tv |
Referenced by ss7_linkset().