Wed Oct 28 11:46:21 2009

Asterisk developer's documentation


time.h File Reference

Time-related functions and macros. More...

#include "asterisk/inline_api.h"

Include dependency graph for time.h:

This graph shows which files directly or indirectly include this file:

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 -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_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


Detailed Description

Time-related functions and macros.

Definition in file time.h.


Function Documentation

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 177 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(), conf_run(), do_cdr(), do_parking_thread(), iax2_process_thread(), jb_get_and_deliver(), mb_poll_thread(), 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 
) [read]

struct timeval ast_tvadd ( struct timeval  a,
struct timeval  b 
) [read]

Returns the sum of two timevals a + b.

Definition at line 1256 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_rtp_sendcng(), ast_rtp_senddigit_begin(), ast_rtp_senddigit_end(), ast_sched_runq(), ast_smoother_read(), ast_translate(), calc_timestamp(), conf_run(), do_cdr(), iax2_process_thread(), jb_get_and_deliver(), mb_poll_thread(), monmp3thread(), mp3_exec(), mwi_monitor_handler(), NBScat_exec(), sched_settime(), sched_thread(), schedule_delivery(), sla_process_timers(), and smdi_message_wait().

01257 {
01258    /* consistency checks to guarantee usec in 0..999999 */
01259    a = tvfix(a);
01260    b = tvfix(b);
01261    a.tv_sec += b.tv_sec;
01262    a.tv_usec += b.tv_usec;
01263    if (a.tv_usec >= ONE_MILLION) {
01264       a.tv_sec++;
01265       a.tv_usec -= ONE_MILLION;
01266    }
01267    return a;
01268 }

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 120 of file time.h.

Referenced by ast_bridge_call(), ast_cdr_merge(), ast_sched_runq(), find_cache(), sched_settime(), schedule(), and send_dtmf().

00127 {

int ast_tvdiff_ms ( struct timeval  end,
struct timeval  start 
) [inline]

int ast_tvdiff_sec ( struct timeval  end,
struct timeval  start 
) [inline]

Computes the difference (in seconds) between two struct timeval instances.

Parameters:
end the end of the time period
start the beginning of the time period
Returns:
the difference in seconds

Definition at line 56 of file time.h.

Referenced by ast_odbc_request_obj(), transmit_audio(), and transmit_t38().

00067 {

int64_t ast_tvdiff_us ( struct timeval  end,
struct timeval  start 
) [inline]

Computes the difference (in microseconds) between two struct timeval instances.

Parameters:
ast_tvdiff_sec 
  • end the end of the time period
  • start the beginning of the time period
Returns:
the difference in microseconds

Definition at line 71 of file time.h.

Referenced by ast_merge_contexts_and_delete(), and transmit_t38().

00081 {

int ast_tveq ( struct timeval  _a,
struct timeval  _b 
) [inline]

Returns true if the two struct timeval arguments are equal.

Definition at line 130 of file time.h.

Referenced by ast_translate().

00137 {

struct timeval ast_tvnow ( void   )  [read]

Returns current timeval. Meant to replace calls to gettimeofday().

Definition at line 142 of file time.h.

Referenced by __ast_read(), __dahdi_exception(), __get_from_jb(), __manager_event(), acf_strftime(), action_coreshowchannels(), 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_careful_fwrite(), ast_carefulwrite(), ast_cdr_answer(), ast_cdr_end(), ast_cdr_getvar(), ast_cdr_start(), ast_channel_bridge(), ast_check_timing(), ast_feature_request_and_dial(), ast_generic_bridge(), ast_log(), ast_merge_contexts_and_delete(), ast_module_reload(), ast_odbc_prepare_and_execute(), ast_odbc_request_obj(), ast_odbc_smart_execute(), ast_rtp_sendcng(), ast_rtp_senddigit_begin(), ast_rtp_senddigit_end(), ast_rwlock_timedrdlock(), ast_rwlock_timedwrlock(), 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_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_translate(), ast_verbose(), ast_wait_for_output(), ast_waitfor_nandfds(), audiohook_read_frame_both(), background_detect_exec(), build_device(), calc_rxstamp(), calc_timestamp(), calc_txstamp(), callerid_genmsg(), canary_thread(), cb_events(), cli_prompt(), conf_run(), create_transaction(), dahdi_answer(), dahdi_call(), 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(), find_cache(), find_conf_realtime(), find_tpeer(), fix_peerts(), get_date(), 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_time_date_req_message(), handle_timeout_trip(), httpd_helper_thread(), iax2_bridge(), iax2_datetime(), iax2_process_thread(), iax2_trunk_queue(), leave_voicemail(), load_config(), login_exec(), main(), 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(), phone_call(), phoneprov_callback(), play_message_datetime(), process_text_line(), purge_old_messages(), qualify_peer(), queue_ringing_trunk(), receive_dtmf_digits(), rpt_tele_thread(), sched_settime(), sched_thread(), send_date_time(), send_date_time2(), send_date_time3(), send_dtmf(), sendmail(), serialize_showchan(), setformat(), should_skip_dtmf(), sip_poke_peer(), 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(), smdi_read(), sms_handleincoming(), sms_handleincoming_proto2(), sms_readfile(), socket_process_meta(), static_callback(), store_config(), timing_read(), transmit_audio(), transmit_notify_request_with_callerid(), transmit_t38(), update_jbsched(), vmu_tm(), wait_for_answer(), waituntil_exec(), write_history(), and write_metadata().

00159 {

struct timeval ast_tvsub ( struct timeval  a,
struct timeval  b 
) [read]

Returns the difference of two timevals a - b.

Definition at line 1270 of file utils.c.

References ONE_MILLION, and tvfix().

Referenced by ast_channel_bridge(), ast_rwlock_timedrdlock(), ast_rwlock_timedwrlock(), ast_sched_dump(), ast_translate(), calc_rxstamp(), calc_timestamp(), conf_run(), handle_showcalls(), and handle_showuptime().

01271 {
01272    /* consistency checks to guarantee usec in 0..999999 */
01273    a = tvfix(a);
01274    b = tvfix(b);
01275    a.tv_sec -= b.tv_sec;
01276    a.tv_usec -= b.tv_usec;
01277    if (a.tv_usec < 0) {
01278       a.tv_sec-- ;
01279       a.tv_usec += ONE_MILLION;
01280    }
01281    return a;
01282 }

int ast_tvzero ( const struct timeval  t  )  [inline]

typedef typeof ( tv.  tv_sec  ) 

Referenced by load_rpt_vars().


Variable Documentation

struct timeval tv


Generated on Wed Oct 28 11:46:21 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6