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

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 _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 | ) |
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().
| ac_maxval_p ac_get_maxval | ( | ac_tm_p | _atp | ) |
Definition at line 213 of file cpl_time.c.
References ac_get_yweek(), is_leap_year, _ac_maxval::mday, _ac_tm::mv, _ac_maxval::mwday, _ac_maxval::mweek, NULL, pkg_malloc, _ac_tm::t, _ac_maxval::yday, _ac_maxval::ywday, and _ac_maxval::yweek.
Referenced by check_byxxx().
| int ac_get_mweek | ( | struct tm * | _tm | ) |
| 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 | ) |
Definition at line 275 of file cpl_time.c.
References _ac_maxval::mday, _ac_tm::mv, _ac_maxval::mwday, _ac_tm::mwday, _ac_maxval::mweek, _ac_tm::mweek, _ac_tm::t, _ac_tm::time, _ac_maxval::yday, _ac_maxval::ywday, _ac_tm::ywday, _ac_maxval::yweek, and _ac_tm::yweek.
| int ac_tm_fill | ( | ac_tm_p | _atp, | |
| struct tm * | _tm | |||
| ) |
Definition at line 118 of file cpl_time.c.
References ac_get_mweek(), ac_get_wday_mr, ac_get_wday_yr, ac_get_yweek(), _ac_tm::mwday, _ac_tm::mweek, _ac_tm::t, _ac_tm::ywday, and _ac_tm::yweek.
Referenced by ac_tm_set_time().
| 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 | ) |
| 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().
Definition at line 1111 of file cpl_time.c.
References ac_get_maxval(), _tmrec::byday, _tmrec::bymday, _tmrec::bymonth, _tmrec::byweekno, _tmrec::byyday, _tmrec::freq, FREQ_MONTHLY, FREQ_YEARLY, _ac_maxval::mday, _ac_maxval::mwday, _ac_tm::mwday, _tr_byxxx::nr, NULL, REC_ERR, REC_MATCH, REC_NOMATCH, _tr_byxxx::req, _ac_tm::t, _tr_byxxx::xxx, _ac_maxval::yday, _ac_maxval::ywday, _ac_tm::ywday, _ac_maxval::yweek, and _ac_tm::yweek.
Referenced by check_tmrec().
Definition at line 995 of file cpl_time.c.
References _IS_SET, _tmrec::freq, FREQ_DAILY, FREQ_MONTHLY, FREQ_WEEKLY, FREQ_YEARLY, _tmrec::interval, REC_ERR, REC_MATCH, REC_NOMATCH, _ac_tm::t, and _tmrec::ts.
Referenced by check_tmrec().
Definition at line 1063 of file cpl_time.c.
References _tmrec::duration, _tr_res::flag, FREQ_DAILY, FREQ_MONTHLY, FREQ_WEEKLY, FREQ_YEARLY, get_min_interval(), REC_ERR, REC_MATCH, REC_NOMATCH, _tr_res::rest, _ac_tm::t, _tmrec::ts, and TSW_RSET.
Referenced by check_tmrec().
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 | ) |
Definition at line 1046 of file cpl_time.c.
References _tmrec::byday, _tmrec::bymday, _tmrec::bymonth, _tmrec::byweekno, _tmrec::byyday, _tmrec::freq, FREQ_DAILY, FREQ_MONTHLY, FREQ_NOFREQ, FREQ_WEEKLY, and FREQ_YEARLY.
Referenced by check_min_unit().
| tr_byxxx_p ic_parse_byday | ( | char * | _in | ) |
Definition at line 658 of file cpl_time.c.
References NULL, _tr_byxxx::req, tr_byxxx_free(), tr_byxxx_init(), tr_byxxx_new(), WDAY_FR, WDAY_MO, WDAY_SA, WDAY_SU, WDAY_TH, WDAY_TU, WDAY_WE, and _tr_byxxx::xxx.
Referenced by tr_parse_byday().
| tr_byxxx_p ic_parse_byxxx | ( | char * | _in | ) |
Definition at line 791 of file cpl_time.c.
References NULL, _tr_byxxx::req, tr_byxxx_free(), tr_byxxx_init(), tr_byxxx_new(), and _tr_byxxx::xxx.
Referenced by tr_parse_bymday(), tr_parse_bymonth(), tr_parse_byweekno(), and tr_parse_byyday().
| 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 | ) |
| 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] |
| int tmrec_free | ( | tmrec_p | _trp | ) |
Definition at line 364 of file cpl_time.c.
References _tmrec::byday, _tmrec::bymday, _tmrec::bymonth, _tmrec::byweekno, _tmrec::byyday, and tr_byxxx_free().
Referenced by run_time_switch().
| 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 | ) |
Definition at line 498 of file cpl_time.c.
References _tmrec::byday, _tmrec::bymday, _tmrec::bymonth, _tmrec::byweekno, _tmrec::byyday, _tmrec::dtend, _tmrec::dtstart, _tmrec::duration, _tmrec::freq, _tmrec::interval, _tr_byxxx::nr, _tr_byxxx::req, _tmrec::ts, _tmrec::until, _tmrec::wkst, and _tr_byxxx::xxx.
| static char* trim | ( | char * | _s | ) | [inline, static] |
1.5.6