#include <sys/time.h>
#include <stdlib.h>
#include "asterisk/inline_api.h"
Go to the source code of this file.
Functions | |
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). | |
timeval | ast_tv (ast_time_t sec, ast_suseconds_t usec) |
Returns a timeval from sec, usec. | |
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 -1, 0, 1 if the first arg is smaller, equal or greater to the second. | |
int | ast_tvdiff_ms (struct timeval end, struct timeval start) |
Computes the difference (in milliseconds) between two struct timeval instances. | |
int | ast_tveq (struct timeval _a, struct timeval _b) |
Returns true if the two struct timeval arguments are equal. | |
timeval | ast_tvnow (void) |
Returns current timeval. Meant to replace calls to gettimeofday(). | |
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 | |
timeval | tv |
Definition in file time.h.
struct timeval ast_samp2tv | ( | unsigned int | _nsamp, | |
unsigned int | _rate | |||
) | [inline] |
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 142 of file time.h.
Referenced by __get_from_jb(), agent_hangup(), agent_read(), ast_audiohook_trigger_wait(), ast_channel_bridge(), ast_generic_bridge(), ast_rtp_read(), ast_smoother_read(), ast_translate(), calc_rxstamp(), calc_timestamp(), do_cdr(), iax2_process_thread(), jb_get_and_deliver(), monmp3thread(), mp3_exec(), NBScat_exec(), process_rfc2833(), sched_settime(), sched_thread(), schedule_delivery(), and sla_process_timers().
struct timeval ast_tv | ( | ast_time_t | sec, | |
ast_suseconds_t | usec | |||
) | [inline] |
Returns a timeval from sec, usec.
Definition at line 130 of file time.h.
Referenced by __dahdi_exception(), __login_exec(), agent_hangup(), agent_request(), ast_cdr_merge(), ast_poll2(), ast_rtp_read(), ast_rtp_sendcng(), ast_rtp_senddigit_begin(), ast_rtp_senddigit_end_with_duration(), ast_sched_add_variable(), ast_sched_runq(), ast_translate(), ast_translator_build_path(), cb_events(), dahdi_read(), do_immediate_setup(), ices_exec(), misdn_read(), msg_timestamp(), mwi_monitor_handler(), phone_exception(), phone_read(), pri_dchannel(), process_rfc2833(), 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 1113 of file utils.c.
References ONE_MILLION, and tvfix().
Referenced by __get_from_jb(), agent_hangup(), agent_read(), ast_audiohook_trigger_wait(), ast_channel_bridge(), ast_generic_bridge(), ast_poll2(), ast_rtp_sendcng(), ast_rtp_senddigit_begin(), ast_rtp_senddigit_end_with_duration(), ast_sched_runq(), ast_smoother_read(), ast_translate(), calc_timestamp(), do_cdr(), iax2_process_thread(), jb_get_and_deliver(), monmp3thread(), mp3_exec(), mwi_monitor_handler(), NBScat_exec(), sched_settime(), sched_thread(), schedule_delivery(), sla_process_timers(), and smdi_message_wait().
01114 { 01115 /* consistency checks to guarantee usec in 0..999999 */ 01116 a = tvfix(a); 01117 b = tvfix(b); 01118 a.tv_sec += b.tv_sec; 01119 a.tv_usec += b.tv_usec; 01120 if (a.tv_usec >= ONE_MILLION) { 01121 a.tv_sec++; 01122 a.tv_usec -= ONE_MILLION; 01123 } 01124 return a; 01125 }
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 85 of file time.h.
Referenced by ast_bridge_call(), ast_cdr_merge(), ast_sched_runq(), create_dtmf_frame(), find_cache(), sched_settime(), and schedule().
int 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 55 of file time.h.
References t.
Referenced by __ast_read(), __get_from_jb(), __login_exec(), __verboser(), agent_cont_sleep(), agents_show(), ast_audiohook_write_frame(), ast_bridge_call(), ast_carefulwrite(), ast_channel_bridge(), ast_generic_bridge(), ast_odbc_request_obj(), ast_poll2(), ast_rtp_read(), ast_sched_wait(), ast_waitfor_nandfds(), audiohook_read_frame_both(), background_detect_exec(), calc_cost(), calc_rxstamp(), calc_timestamp(), calc_txpeerstamp(), calc_txstamp(), cli_audio_convert(), cli_audio_convert_deprecated(), dahdi_handle_event(), destroy_trans(), disa_exec(), do_parking_thread(), dundi_do_lookup(), dundi_do_precache(), dundi_lookup_internal(), dundi_precache_internal(), dundi_query_eid_internal(), feature_request_and_dial(), fix_peerts(), get_now(), handle_chanlist(), handle_chanlist_deprecated(), handle_recordfile(), handle_response_peerpoke(), measurenoise(), misdn_overlap_dial_task(), misdn_read(), monmp3thread(), mp3_exec(), NBScat_exec(), pri_dchannel(), process_rfc2833(), purge_old_messages(), receive_dtmf_digits(), setformat(), should_skip_dtmf(), sla_calc_station_timeouts(), sla_calc_trunk_timeouts(), sla_check_failed_station(), sla_check_station_delay(), smdi_message_wait(), and update_jbsched().
int ast_tveq | ( | struct timeval | _a, | |
struct timeval | _b | |||
) | [inline] |
Returns true if the two struct
timeval
arguments are equal.
Definition at line 95 of file time.h.
References t.
Referenced by ast_translate().
struct timeval ast_tvnow | ( | void | ) | [inline] |
Returns current timeval. Meant to replace calls to gettimeofday().
Definition at line 107 of file time.h.
Referenced by __ast_read(), __login_exec(), action_status(), add_agent(), agent_cont_sleep(), agent_hangup(), agent_read(), agent_request(), agents_show(), ast_audiohook_trigger_wait(), ast_audiohook_write_frame(), ast_bridge_call(), ast_carefulwrite(), ast_cdr_answer(), ast_cdr_end(), ast_cdr_start(), ast_channel_bridge(), ast_generic_bridge(), ast_odbc_prepare_and_execute(), ast_odbc_request_obj(), ast_odbc_smart_execute(), ast_poll2(), ast_rtp_sendcng(), ast_rtp_senddigit_begin(), ast_rtp_senddigit_end_with_duration(), ast_rwlock_timedrdlock(), ast_rwlock_timedwrlock(), ast_sched_dump(), ast_sched_runq(), ast_sched_wait(), ast_sched_when(), ast_translate(), ast_waitfor_nandfds(), audiohook_read_frame_both(), background_detect_exec(), calc_cost(), calc_rxstamp(), calc_timestamp(), calc_txstamp(), cb_events(), cli_audio_convert(), cli_audio_convert_deprecated(), create_dtmf_frame(), create_transaction(), dahdi_handle_event(), destroy_trans(), disa_exec(), do_cdr(), do_parking_thread(), dundi_do_lookup(), dundi_do_precache(), dundi_lookup_internal(), dundi_precache_internal(), dundi_query_eid_internal(), feature_request_and_dial(), handle_chanlist(), handle_chanlist_deprecated(), handle_recordfile(), handle_response_peerpoke(), handle_showchan(), handle_showchan_deprecated(), iax2_process_thread(), manager_event(), measurenoise(), misdn_overlap_dial_task(), misdn_read(), monmp3thread(), mp3_exec(), mwi_monitor_handler(), NBScat_exec(), odbc_obj_connect(), park_call_full(), play_message_datetime(), pri_dchannel(), purge_old_messages(), qualify_peer(), queue_ringing_trunk(), receive_dtmf_digits(), sched_settime(), sched_thread(), serialize_showchan(), setformat(), should_skip_dtmf(), sla_calc_station_timeouts(), sla_calc_trunk_timeouts(), sla_check_failed_station(), sla_check_station_delay(), sla_create_ringing_station(), sla_process_timers(), sla_ring_station(), smdi_message_wait(), socket_process(), store_config(), update_jbsched(), and wait_for_answer().
struct timeval ast_tvsub | ( | struct timeval | a, | |
struct timeval | b | |||
) |
Returns the difference of two timevals a - b.
Definition at line 1127 of file utils.c.
References ONE_MILLION, and tvfix().
Referenced by ast_channel_bridge(), ast_poll2(), ast_rwlock_timedrdlock(), ast_rwlock_timedwrlock(), ast_sched_dump(), ast_translate(), calc_rxstamp(), calc_timestamp(), and pri_dchannel().
01128 { 01129 /* consistency checks to guarantee usec in 0..999999 */ 01130 a = tvfix(a); 01131 b = tvfix(b); 01132 a.tv_sec -= b.tv_sec; 01133 a.tv_usec -= b.tv_usec; 01134 if (a.tv_usec < 0) { 01135 a.tv_sec-- ; 01136 a.tv_usec += ONE_MILLION; 01137 } 01138 return a; 01139 }
int ast_tvzero | ( | const struct timeval | t | ) | [inline] |
Returns true if the argument is 0,0.
Definition at line 65 of file time.h.
Referenced by __ast_read(), __verboser(), append_date(), ast_bridge_call(), ast_cdr_answer(), ast_cdr_end(), ast_cdr_fork(), ast_cdr_free(), ast_cdr_merge(), ast_channel_bridge(), ast_generic_bridge(), ast_rtp_raw_write(), ast_smoother_read(), ast_translate(), calc_rxstamp(), calc_timestamp(), calc_txpeerstamp(), calc_txstamp(), do_monitor(), fix_peerts(), get_date(), handle_chanlist(), handle_chanlist_deprecated(), misdn_read(), monmp3thread(), post_cdr(), sched_settime(), schedule_delivery(), should_skip_dtmf(), smoother_frame_feed(), and socket_process().
typedef typeof | ( | tv. | tv_sec | ) |
Referenced by load_rpt_vars().
struct timeval tv |
Referenced by ast_manager_register_struct(), ast_manager_unregister(), and iax2_bridge().