cpl_time.c File Reference

#include <stdio.h>
#include <string.h>
#include <time.h>
#include "../../mem/mem.h"
#include "cpl_time.h"

Include dependency graph for cpl_time.c:

Go to the source code of this file.

Defines

#define _D(c)   ((c) -'0')
#define _IS_SET(x)   (((x)>0)?1:0)
#define ac_get_wday_mr(t)   (int)(((t)->tm_mday-1)/7)
#define ac_get_wday_yr(t)   (int)((t)->tm_yday/7)
#define MON_WEEK(t)
#define REC_ERR   -1
#define REC_MATCH   0
#define REC_NOMATCH   1

Functions

ac_maxval_p ac_get_maxval (ac_tm_p _atp)
int ac_get_mweek (struct tm *_tm)
int ac_get_wkst (void)
int ac_get_yweek (struct tm *_tm)
int ac_print (ac_tm_p _atp)
int ac_tm_fill (ac_tm_p _atp, struct tm *_tm)
int ac_tm_free (ac_tm_p _atp)
ac_tm_p ac_tm_new (void)
int ac_tm_reset (ac_tm_p _atp)
int ac_tm_set_time (ac_tm_p _atp, time_t _t)
int check_byxxx (tmrec_p, ac_tm_p)
int check_freq_interval (tmrec_p _trp, ac_tm_p _atp)
int check_min_unit (tmrec_p, ac_tm_p, tr_res_p)
int check_tmrec (tmrec_p _trp, ac_tm_p _atp, tr_res_p _tsw)
int get_min_interval (tmrec_p)
tr_byxxx_p ic_parse_byday (char *_in)
tr_byxxx_p ic_parse_byxxx (char *_in)
time_t ic_parse_datetime (char *_in, struct tm *_tm)
time_t ic_parse_duration (char *_in)
int ic_parse_wkst (char *_in)
static int strz2int (char *_bp)
int tmrec_free (tmrec_p _trp)
tmrec_p tmrec_new (void)
int tr_byxxx_free (tr_byxxx_p _bxp)
int tr_byxxx_init (tr_byxxx_p _bxp, int _nr)
tr_byxxx_p tr_byxxx_new (void)
int tr_parse_byday (tmrec_p _trp, char *_in)
int tr_parse_bymday (tmrec_p _trp, char *_in)
int tr_parse_bymonth (tmrec_p _trp, char *_in)
int tr_parse_byweekno (tmrec_p _trp, char *_in)
int tr_parse_byyday (tmrec_p _trp, char *_in)
int tr_parse_dtend (tmrec_p _trp, char *_in)
int tr_parse_dtstart (tmrec_p _trp, char *_in)
int tr_parse_duration (tmrec_p _trp, char *_in)
int tr_parse_freq (tmrec_p _trp, char *_in)
int tr_parse_interval (tmrec_p _trp, char *_in)
int tr_parse_until (tmrec_p _trp, char *_in)
int tr_parse_wkst (tmrec_p _trp, char *_in)
int tr_print (tmrec_p _trp)
static char * trim (char *_s)


Define Documentation

#define _D (  )     ((c) -'0')

Definition at line 307 of file cpl_time.c.

Referenced by ic_parse_datetime().

#define _IS_SET (  )     (((x)>0)?1:0)

Definition at line 932 of file cpl_time.c.

Referenced by check_freq_interval(), and check_tmrec().

#define ac_get_wday_mr (  )     (int)(((t)->tm_mday-1)/7)

Definition at line 105 of file cpl_time.c.

Referenced by ac_tm_fill().

#define ac_get_wday_yr (  )     (int)((t)->tm_yday/7)

Definition at line 104 of file cpl_time.c.

Referenced by ac_tm_fill().

#define MON_WEEK (  ) 

Value:

(int)(((t)->tm_yday + 7 - \
            ((t)->tm_wday ? (t)->tm_wday - 1 : 6)) / 7)

Definition at line 100 of file cpl_time.c.

Referenced by ac_get_yweek().

#define REC_ERR   -1

Definition at line 928 of file cpl_time.c.

Referenced by check_byxxx(), check_freq_interval(), check_min_unit(), and check_tmrec().

#define REC_MATCH   0

Definition at line 929 of file cpl_time.c.

Referenced by check_byxxx(), check_freq_interval(), check_min_unit(), and check_tmrec().

#define REC_NOMATCH   1

Definition at line 930 of file cpl_time.c.

Referenced by check_byxxx(), check_freq_interval(), check_min_unit(), and check_tmrec().


Function Documentation

ac_maxval_p ac_get_maxval ( ac_tm_p  _atp  ) 

int ac_get_mweek ( struct tm *  _tm  ) 

Definition at line 147 of file cpl_time.c.

Referenced by ac_tm_fill().

int ac_get_wkst ( void   ) 

Definition at line 186 of file cpl_time.c.

int ac_get_yweek ( struct tm *  _tm  ) 

Definition at line 158 of file cpl_time.c.

References MON_WEEK.

Referenced by ac_get_maxval(), and ac_tm_fill().

int ac_print ( ac_tm_p  _atp  ) 

int ac_tm_fill ( ac_tm_p  _atp,
struct tm *  _tm 
)

int ac_tm_free ( ac_tm_p  _atp  ) 

Definition at line 203 of file cpl_time.c.

References _ac_tm::mv, and pkg_free.

Referenced by run_time_switch().

ac_tm_p ac_tm_new ( void   ) 

Definition at line 107 of file cpl_time.c.

References NULL, and pkg_malloc.

int ac_tm_reset ( ac_tm_p  _atp  ) 

Definition at line 195 of file cpl_time.c.

int ac_tm_set_time ( ac_tm_p  _atp,
time_t  _t 
)

Definition at line 139 of file cpl_time.c.

References ac_tm_fill(), and _ac_tm::time.

Referenced by run_time_switch().

int check_byxxx ( tmrec_p  _trp,
ac_tm_p  _atp 
)

int check_freq_interval ( tmrec_p  _trp,
ac_tm_p  _atp 
)

int check_min_unit ( tmrec_p  _trp,
ac_tm_p  _atp,
tr_res_p  _tsw 
)

int check_tmrec ( tmrec_p  _trp,
ac_tm_p  _atp,
tr_res_p  _tsw 
)

return 0/REC_MATCH - the time falls in -1/REC_ERR - error 1/REC_NOMATCH - the time falls out

Definition at line 946 of file cpl_time.c.

References _IS_SET, check_byxxx(), check_freq_interval(), check_min_unit(), _tmrec::dtend, _tmrec::dtstart, _tmrec::duration, _tr_res::flag, REC_ERR, REC_MATCH, REC_NOMATCH, _tr_res::rest, _ac_tm::time, TSW_RSET, and _tmrec::until.

Referenced by run_time_switch().

int get_min_interval ( tmrec_p  _trp  ) 

tr_byxxx_p ic_parse_byday ( char *  _in  ) 

tr_byxxx_p ic_parse_byxxx ( char *  _in  ) 

time_t ic_parse_datetime ( char *  _in,
struct tm *  _tm 
)

Definition at line 559 of file cpl_time.c.

References _D.

Referenced by tr_parse_dtend(), tr_parse_dtstart(), and tr_parse_until().

time_t ic_parse_duration ( char *  _in  ) 

Definition at line 576 of file cpl_time.c.

Referenced by tr_parse_duration().

int ic_parse_wkst ( char *  _in  ) 

Definition at line 860 of file cpl_time.c.

References WDAY_FR, WDAY_MO, WDAY_SA, WDAY_SU, WDAY_TH, WDAY_TU, and WDAY_WE.

Referenced by tr_parse_wkst().

static int strz2int ( char *  _bp  )  [inline, static]

Definition at line 39 of file cpl_time.c.

Referenced by tr_parse_interval().

int tmrec_free ( tmrec_p  _trp  ) 

tmrec_p tmrec_new ( void   ) 

Definition at line 353 of file cpl_time.c.

References _tmrec::dtstart, NULL, pkg_malloc, and _tmrec::ts.

int tr_byxxx_free ( tr_byxxx_p  _bxp  ) 

Definition at line 341 of file cpl_time.c.

References pkg_free, _tr_byxxx::req, and _tr_byxxx::xxx.

Referenced by ic_parse_byday(), ic_parse_byxxx(), and tmrec_free().

int tr_byxxx_init ( tr_byxxx_p  _bxp,
int  _nr 
)

Definition at line 319 of file cpl_time.c.

References _tr_byxxx::nr, pkg_free, pkg_malloc, _tr_byxxx::req, and _tr_byxxx::xxx.

Referenced by ic_parse_byday(), and ic_parse_byxxx().

tr_byxxx_p tr_byxxx_new ( void   ) 

Definition at line 309 of file cpl_time.c.

References NULL, and pkg_malloc.

Referenced by ic_parse_byday(), and ic_parse_byxxx().

int tr_parse_byday ( tmrec_p  _trp,
char *  _in 
)

Definition at line 450 of file cpl_time.c.

References _tmrec::byday, and ic_parse_byday().

Referenced by run_time_switch().

int tr_parse_bymday ( tmrec_p  _trp,
char *  _in 
)

Definition at line 458 of file cpl_time.c.

References _tmrec::bymday, and ic_parse_byxxx().

Referenced by run_time_switch().

int tr_parse_bymonth ( tmrec_p  _trp,
char *  _in 
)

Definition at line 474 of file cpl_time.c.

References _tmrec::bymonth, and ic_parse_byxxx().

Referenced by run_time_switch().

int tr_parse_byweekno ( tmrec_p  _trp,
char *  _in 
)

Definition at line 482 of file cpl_time.c.

References _tmrec::byweekno, and ic_parse_byxxx().

Referenced by run_time_switch().

int tr_parse_byyday ( tmrec_p  _trp,
char *  _in 
)

Definition at line 466 of file cpl_time.c.

References _tmrec::byyday, and ic_parse_byxxx().

Referenced by run_time_switch().

int tr_parse_dtend ( tmrec_p  _trp,
char *  _in 
)

Definition at line 387 of file cpl_time.c.

References _tmrec::dtend, and ic_parse_datetime().

Referenced by run_time_switch().

int tr_parse_dtstart ( tmrec_p  _trp,
char *  _in 
)

Definition at line 379 of file cpl_time.c.

References _tmrec::dtstart, ic_parse_datetime(), and _tmrec::ts.

Referenced by run_time_switch().

int tr_parse_duration ( tmrec_p  _trp,
char *  _in 
)

Definition at line 396 of file cpl_time.c.

References _tmrec::duration, and ic_parse_duration().

Referenced by run_time_switch().

int tr_parse_freq ( tmrec_p  _trp,
char *  _in 
)

Definition at line 413 of file cpl_time.c.

References _tmrec::freq, FREQ_DAILY, FREQ_MONTHLY, FREQ_NOFREQ, FREQ_WEEKLY, and FREQ_YEARLY.

Referenced by run_time_switch().

int tr_parse_interval ( tmrec_p  _trp,
char *  _in 
)

Definition at line 442 of file cpl_time.c.

References _tmrec::interval, and strz2int().

Referenced by run_time_switch().

int tr_parse_until ( tmrec_p  _trp,
char *  _in 
)

Definition at line 404 of file cpl_time.c.

References ic_parse_datetime(), and _tmrec::until.

Referenced by run_time_switch().

int tr_parse_wkst ( tmrec_p  _trp,
char *  _in 
)

Definition at line 490 of file cpl_time.c.

References ic_parse_wkst(), and _tmrec::wkst.

Referenced by run_time_switch().

int tr_print ( tmrec_p  _trp  ) 

static char* trim ( char *  _s  )  [inline, static]

Definition at line 56 of file cpl_time.c.

References len.


Generated on Mon May 21 18:00:38 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6