Wed Aug 15 01:25:35 2007

Asterisk developer's documentation


time.h File Reference

Time-related functions and macros. More...

#include <sys/time.h>
#include <stdlib.h>
#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

 AST_INLINE_API (struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec),{struct timeval t;t.tv_sec=sec;t.tv_usec=usec;return t;}) AST_INLINE_API(struct timeval ast_samp2tv(unsigned int _nsamp
 Returns a timeval from sec, usec.
 AST_INLINE_API (int ast_tvdiff_ms(struct timeval end, struct timeval start),{return((end.tv_sec-start.tv_sec)*1000)+(((1000000+end.tv_usec-start.tv_usec)/1000)-1000);}) AST_INLINE_API(int ast_tvzero(const struct timeval t)
 Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvsub (struct timeval a, struct timeval b)
 Returns the difference of two timevals a - b.
typedef typeof (tv.tv_sec) ast_time_t

Variables

unsigned int _rate
struct timeval tv


Detailed Description

Time-related functions and macros.

Definition in file time.h.


Function Documentation

AST_INLINE_API ( struct timeval   ast_tv(ast_time_t sec, ast_suseconds_t usec)  ) 

Returns a timeval from sec, usec.

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)

AST_INLINE_API ( int   ast_tvdiff_ms(struct timeval end, struct timeval start)  )  const

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

Parameters:
end the beginning of the time period
start the end of the time period
Returns:
the difference in milliseconds
Returns true if the argument is 0,0

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

Returns the difference of two timevals a - b.

Definition at line 982 of file utils.c.

References ONE_MILLION, and tvfix().

00983 {
00984    /* consistency checks to guarantee usec in 0..999999 */
00985    a = tvfix(a);
00986    b = tvfix(b);
00987    a.tv_sec -= b.tv_sec;
00988    a.tv_usec -= b.tv_usec;
00989    if (a.tv_usec < 0) {
00990       a.tv_sec-- ;
00991       a.tv_usec += ONE_MILLION;
00992    }
00993    return a;
00994 }

typedef typeof ( tv.  tv_sec  ) 


Variable Documentation

unsigned int _rate

Definition at line 138 of file time.h.

struct timeval tv

Referenced by iax2_bridge().


Generated on Wed Aug 15 01:25:35 2007 for Asterisk - the Open Source PBX by  doxygen 1.5.3