Time-related functions and macros. More...
Go to the source code of this file.
Functions | |
int | ast_remaining_ms (struct timeval start, int max_ms) |
Calculate remaining milliseconds given a starting timestamp and upper bound. More... | |
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) More... | |
struct timeval | ast_tv (ast_time_t sec, ast_suseconds_t usec) |
Returns a timeval from sec, usec. More... | |
struct timeval | ast_tvadd (struct timeval a, struct timeval b) |
Returns the sum of two timevals a + b. More... | |
int | ast_tvcmp (struct timeval _a, struct timeval _b) |
Compres two struct timeval instances returning -1, 0, 1 if the first arg is smaller, equal or greater to the second. More... | |
int64_t | ast_tvdiff_ms (struct timeval end, struct timeval start) |
Computes the difference (in milliseconds) between two struct timeval instances. More... | |
int64_t | ast_tvdiff_sec (struct timeval end, struct timeval start) |
Computes the difference (in seconds) between two struct timeval instances. More... | |
int64_t | ast_tvdiff_us (struct timeval end, struct timeval start) |
Computes the difference (in microseconds) between two struct timeval instances. More... | |
int | ast_tveq (struct timeval _a, struct timeval _b) |
Returns true if the two struct timeval arguments are equal. More... | |
struct timeval | ast_tvnow (void) |
Returns current timeval. Meant to replace calls to gettimeofday(). More... | |
struct timeval | ast_tvsub (struct timeval a, struct timeval b) |
Returns the difference of two timevals a - b. More... | |
int | ast_tvzero (const struct timeval t) |
Returns true if the argument is 0,0. More... | |
typedef | typeof (tv.tv_sec) ast_time_t |
Variables | |
struct timeval | tv |
Time-related functions and macros.
Definition in file time.h.
int ast_remaining_ms | ( | struct timeval | start, |
int | max_ms | ||
) |
Calculate remaining milliseconds given a starting timestamp and upper bound.
If the upper bound is negative, then this indicates that there is no upper bound on the amount of time to wait. This will result in a negative return.
start | When timing started being calculated |
max_ms | The maximum number of milliseconds to wait from start. May be negative. |
Definition at line 1615 of file utils.c.
References ast_tvdiff_ms(), and ast_tvnow().
Referenced by __analog_ss_thread(), __ast_answer(), __ast_request_and_dial(), agent_ack_sleep(), analog_ss_thread(), ast_recvtext(), ast_safe_sleep_conditional(), ast_waitfordigit_full(), async_wait(), dahdi_bridge(), disable_t38(), do_idle_thread(), find_cache(), generic_fax_exec(), local_bridge_loop(), receivefax_t38_init(), record_exec(), remote_bridge_loop(), sendfax_t38_init(), tcptls_stream_read(), tcptls_stream_write(), wait_for_answer(), and waitforring_exec().
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)
Definition at line 191 of file time.h.
Referenced by __get_from_jb(), agent_hangup(), ast_audiohook_trigger_wait(), ast_channel_bridge(), ast_generic_bridge(), ast_rtp_read(), ast_smoother_read(), ast_translate(), calc_rxstamp(), calc_timestamp(), cli_tps_ping(), conf_run(), do_cdr(), iax2_process_thread(), jb_get_and_deliver(), mb_poll_thread(), monmp3thread(), mp3_exec(), NBScat_exec(), process_dtmf_rfc2833(), sched_run(), sched_settime(), schedule_delivery(), and sla_process_timers().
struct timeval ast_tv | ( | ast_time_t | sec, |
ast_suseconds_t | usec | ||
) |
Returns a timeval from sec, usec.
Definition at line 179 of file time.h.
Referenced by __dahdi_exception(), acf_jabberreceive_read(), agent_request(), analog_exception(), ast_cdr_merge(), ast_poll2(), ast_rtp_dtmf_begin(), ast_rtp_dtmf_end_with_duration(), ast_rtp_read(), ast_rtp_sendcng(), ast_sched_add_variable(), ast_sched_runq(), ast_translate(), ast_translator_build_path(), cb_events(), dahdi_read(), do_immediate_setup(), do_monitor(), do_timing(), login_exec(), misdn_read(), msg_timestamp(), mwi_monitor_handler(), phone_exception(), phone_read(), pri_dchannel(), process_dtmf_rfc2833(), pthread_timer_set_rate(), schedule_delivery(), and smdi_message_wait().
struct timeval ast_tvadd | ( | struct timeval | a, |
struct timeval | b | ||
) |
Returns the sum of two timevals a + b.
Definition at line 1587 of file utils.c.
References ONE_MILLION, and tvfix().
Referenced by __get_from_jb(), acf_jabberreceive_read(), agent_hangup(), ast_audiohook_trigger_wait(), ast_channel_bridge(), ast_channel_cmpwhentohangup_tv(), ast_channel_setwhentohangup_tv(), ast_generic_bridge(), ast_poll2(), ast_rtp_dtmf_begin(), ast_rtp_dtmf_end_with_duration(), ast_rtp_sendcng(), ast_sched_runq(), ast_smoother_read(), ast_translate(), calc_rxstamp(), calc_timestamp(), cli_tps_ping(), conf_run(), dial_exec_full(), do_cdr(), do_timing(), iax2_process_thread(), jb_get_and_deliver(), mb_poll_thread(), monmp3thread(), mp3_exec(), mwi_monitor_handler(), NBScat_exec(), sched_run(), sched_settime(), schedule_delivery(), sla_process_timers(), smdi_message_wait(), and timeout_write().
|
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 120 of file time.h.
Referenced by ast_bridge_call(), ast_cdr_merge(), ast_sched_runq(), ast_waitfor_nandfds(), create_dtmf_frame(), find_cache(), pri_dchannel(), sched_settime(), and sched_time_cmp().
|
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 90 of file time.h.
Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_read(), __get_from_jb(), acf_jabberreceive_read(), action_coreshowchannels(), agent_ack_sleep(), agent_cont_sleep(), agent_request(), ast_audiohook_write_frame(), ast_bridge_call(), ast_bridge_end_dtmf(), ast_careful_fwrite(), ast_carefulwrite(), ast_cdr_getvar(), ast_channel_bridge(), ast_channel_cmpwhentohangup_tv(), ast_check_hangup(), ast_generic_bridge(), ast_get_enum(), ast_poll2(), ast_remaining_ms(), ast_rtp_read(), ast_sched_wait(), ast_waitfor_nandfds(), audiohook_read_frame_both(), background_detect_exec(), calc_rxstamp(), calc_timestamp(), calc_txpeerstamp(), calc_txstamp(), check_timer(), conf_run(), dahdi_handle_event(), dahdi_read(), destroy_trans(), disa_exec(), dundi_do_lookup(), dundi_do_precache(), dundi_lookup_internal(), dundi_precache_internal(), dundi_query_eid_internal(), eventhandler(), feature_request_and_dial(), fix_peerts(), get_now(), handle_chanlist(), handle_cli_file_convert(), handle_recordfile(), handle_response_peerpoke(), handle_timeout_trip(), login_exec(), manage_parked_call(), measurenoise(), misdn_overlap_dial_task(), misdn_read(), monmp3thread(), mp3_exec(), NBScat_exec(), pri_dchannel(), process_dtmf_rfc2833(), purge_old_fn(), purge_old_messages(), receive_dtmf_digits(), retrans_pkt(), setformat(), should_skip_dtmf(), show_chanstats_cb(), sla_calc_station_timeouts(), sla_calc_trunk_timeouts(), sla_check_failed_station(), sla_check_station_delay(), smdi_message_wait(), speech_background(), timeout_read(), timing_test(), update_jbsched(), wait_for_output(), and waituntil_exec().
|
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 _ast_odbc_request_obj2(), acf_jabberreceive_read(), delete_old_messages(), purge_events(), transmit_audio(), and transmit_t38().
|
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 ast_merge_contexts_and_delete(), cdr_read(), execute_cb(), odbc_log(), pgsql_log(), sqlite_log(), tds_log(), and transmit_t38().
|
inline |
Returns true if the two struct
timeval
arguments are equal.
Definition at line 130 of file time.h.
Referenced by ast_translate().
struct timeval ast_tvnow | ( | void | ) |
Returns current timeval. Meant to replace calls to gettimeofday().
Definition at line 142 of file time.h.
Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_answer(), __ast_manager_event_multichan(), __ast_read(), __ast_request_and_dial(), __ast_rwlock_timedrdlock(), __ast_rwlock_timedwrlock(), __ast_verbose_ap(), __dahdi_exception(), __get_from_jb(), __sip_reliable_xmit(), _ast_odbc_request_obj2(), _sip_tcp_helper_thread(), acf_jabberreceive_read(), acf_strftime(), action_coreshowchannels(), action_ping(), action_status(), add_agent(), agent_ack_sleep(), agent_cont_sleep(), agent_hangup(), agent_request(), aji_handle_message(), alloc_event(), analog_call(), analog_ss_thread(), append_event(), ast_audiohook_trigger_wait(), ast_audiohook_write_frame(), ast_bridge_call(), ast_bridge_end_dtmf(), ast_careful_fwrite(), ast_carefulwrite(), ast_cdr_answer(), ast_cdr_end(), ast_cdr_getvar(), ast_cdr_start(), ast_cel_report_event(), ast_channel_bridge(), ast_channel_cmpwhentohangup_tv(), ast_channel_setwhentohangup_tv(), ast_check_hangup(), ast_check_timing(), ast_generic_bridge(), ast_get_enum(), ast_http_send(), ast_log(), ast_merge_contexts_and_delete(), ast_module_reload(), ast_odbc_prepare_and_execute(), ast_odbc_smart_execute(), ast_poll2(), ast_queue_log(), ast_recvtext(), ast_remaining_ms(), ast_rtp_dtmf_begin(), ast_rtp_dtmf_end_with_duration(), ast_rtp_sendcng(), ast_safe_sleep_conditional(), 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_it(), 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_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_sched_dump(), ast_sched_runq(), ast_sched_wait(), ast_sched_when(), ast_senddigit_begin(), ast_translate(), ast_waitfor_nandfds(), ast_waitfordigit_full(), async_wait(), audiohook_read_frame_both(), authenticate(), background_detect_exec(), build_device(), calc_rxstamp(), calc_timestamp(), calc_txstamp(), caldav_load_calendar(), calendar_busy_callback(), calendar_devstate_change(), calendar_write_exec(), callerid_genmsg(), canary_thread(), cb_events(), cdr_read(), check_timer(), cleanup(), cli_prompt(), cli_tps_ping(), conf_run(), create_dtmf_frame(), create_transaction(), dahdi_bridge(), dahdi_handle_event(), dahdi_read(), debug_check_frame_for_silence(), delete_old_messages(), destroy_trans(), dial_exec_full(), disa_exec(), disable_t38(), do_cdr(), do_idle_thread(), do_refresh(), do_timing(), dundi_do_lookup(), dundi_do_precache(), dundi_lookup_internal(), dundi_precache_internal(), dundi_query_eid_internal(), eventhandler(), ewscal_load_calendar(), exchangecal_load_calendar(), feature_request_and_dial(), find_cache(), find_conf_realtime(), find_tpeer(), fix_peerts(), generic_fax_exec(), get_date(), get_ewscal_ids_for(), get_lock(), get_tick_count(), handle_chanlist(), handle_cli_file_convert(), handle_cli_iax2_show_cache(), handle_recordfile(), handle_response_peerpoke(), handle_response_register(), handle_showcalls(), handle_showchan(), handle_showuptime(), handle_timeout_trip(), iax2_bridge(), iax2_datetime(), iax2_process_thread(), iax2_trunk_queue(), ical_load_calendar(), leave_voicemail(), load_config(), local_bridge_loop(), login_exec(), main(), manage_parked_call(), mb_poll_thread(), measurenoise(), mgcp_postrequest(), misdn_overlap_dial_task(), misdn_read(), monitor_dial(), monmp3thread(), mp3_exec(), mwi_monitor_handler(), NBScat_exec(), odbc_obj_connect(), park_call_full(), pbx_builtin_gotoiftime(), phone_call(), play_message_datetime(), pri_dchannel(), process_text_line(), pthread_timer_set_rate(), purge_events(), purge_old_messages(), qualify_peer(), queue_ringing_trunk(), realtime_common(), receive_dtmf_digits(), receivefax_t38_init(), record_exec(), remote_bridge_loop(), retrans_pkt(), rt_extend_conf(), sched_run(), sched_settime(), schedule_calendar_event(), send_date_time(), send_date_time2(), send_date_time3(), sendfax_t38_init(), sendmail(), serialize_showchan(), session_do(), setformat(), should_skip_dtmf(), show_chanstats_cb(), sip_poke_peer(), sla_calc_station_timeouts(), sla_calc_trunk_timeouts(), sla_check_failed_station(), sla_check_station_delay(), sla_create_failed_station(), sla_create_ringing_station(), sla_process_timers(), smdi_message_wait(), smdi_read(), sms_handleincoming(), sms_handleincoming_proto2(), sms_readfile(), sms_writefile(), socket_process_meta(), speech_background(), store_config(), tcptls_stream_read(), tcptls_stream_write(), timeout_read(), timeout_write(), timing_read(), timing_test(), transmit_audio(), transmit_definetimedate(), transmit_notify_request_with_callerid(), transmit_t38(), update_caldav(), update_exchangecal(), update_jbsched(), vmu_tm(), wait_for_answer(), wait_for_output(), waitforring_exec(), waituntil_exec(), write_history(), and write_metadata().
struct timeval ast_tvsub | ( | struct timeval | a, |
struct timeval | b | ||
) |
Returns the difference of two timevals a - b.
Definition at line 1601 of file utils.c.
References ONE_MILLION, and tvfix().
Referenced by ast_channel_bridge(), ast_poll2(), ast_sched_dump(), ast_translate(), ast_waitfor_nandfds(), calc_rxstamp(), calc_timestamp(), cli_tps_ping(), conf_run(), debug_check_frame_for_silence(), handle_showcalls(), handle_showuptime(), and pri_dchannel().
|
inline |
Returns true if the argument is 0,0.
Definition at line 100 of file time.h.
Referenced by __ast_read(), action_coreshowchannels(), append_date(), ast_bridge_call(), ast_cdr_answer(), ast_cdr_end(), ast_cdr_fork(), ast_cdr_getvar(), ast_cdr_merge(), ast_channel_bridge(), ast_channel_cmpwhentohangup_tv(), ast_channel_setwhentohangup_tv(), ast_check_hangup(), ast_generic_bridge(), ast_rtp_raw_write(), ast_smoother_read(), ast_translate(), ast_var_channels_table(), ast_waitfor_nandfds(), calc_rxstamp(), calc_timestamp(), calc_txpeerstamp(), calc_txstamp(), cdr_read(), conf_run(), dial_exec_full(), do_monitor(), execute_cb(), fix_peerts(), get_date(), handle_chanlist(), iax2_bridge(), misdn_read(), monmp3thread(), odbc_log(), pgsql_log(), sched_settime(), schedule_delivery(), should_skip_dtmf(), show_chanstats_cb(), smoother_frame_feed(), sms_writefile(), socket_process_meta(), sqlite_log(), tds_log(), timeout_read(), and timeout_write().
typedef typeof | ( | tv. | tv_sec | ) |
Referenced by ast_str_buffer().
struct timeval tv |
Referenced by pri_dchannel().