libamxp
1.4.0
Patterns C Implementation
|
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <amxc/amxc.h>
#include <amxp/amxp_cron.h>
#include <amxc/amxc_macros.h>
#include "amxp_cron_parser_priv.h"
Go to the source code of this file.
Macros | |
#define | _GNU_SOURCE |
#define | CRON_MAX_SECONDS 60 |
#define | CRON_MAX_MINUTES 60 |
#define | CRON_MAX_HOURS 24 |
#define | CRON_MAX_DAYS_OF_WEEK 8 |
#define | CRON_MAX_DAYS_OF_MONTH 32 |
#define | CRON_MAX_MONTHS 13 |
#define | CRON_CF_SECOND 0 |
#define | CRON_CF_MINUTE 1 |
#define | CRON_CF_HOUR_OF_DAY 2 |
#define | CRON_CF_DAY_OF_WEEK 3 |
#define | CRON_CF_DAY_OF_MONTH 4 |
#define | CRON_CF_MONTH 5 |
#define | CRON_CF_YEAR 6 |
#define | CRON_CF_ARR_LEN 7 |
Functions | |
static int32_t | amxp_cron_next_bit (const uint8_t *bits, int32_t from_index, int32_t to_index, bool forwards, bool *notfound) |
static void | push_to_fields_arr (int *arr, int fi) |
static int | last_day_of_month (int month, int year) |
static int | amxp_cron_reset_min (struct tm *calendar, int field) |
static int | amxp_cron_reset_max (struct tm *calendar, int field) |
static int | amxp_cron_reset_all (struct tm *calendar, int *fields, bool minimum) |
static int | amxp_cron_set_field (struct tm *calendar, int field, int val, bool add) |
static uint32_t | amxp_cron_find_next (const uint8_t *bits, int32_t max, int32_t value, struct tm *calendar, uint32_t field, uint32_t next_field, int *lower_orders, bool forward, int *res_out) |
static unsigned int | amxp_cron_find_next_day (struct tm *calendar, const uint8_t *days_of_month, unsigned int day_of_month, const uint8_t *days_of_week, unsigned int day_of_week, int *resets, bool forward, int *res_out) |
static int | amxp_cron_calc_next (const amxp_cron_expr_t *expr, struct tm *calendar, unsigned int dot, bool forwards) |
static void | amxp_cron_remove_spaces (amxc_string_t *result, const char *days_of_week) |
int | amxp_cron_new (amxp_cron_expr_t **cron_expr) |
Allocates an amxp_cron_expr_t structures and initializes it to every second. More... | |
void | amxp_cron_delete (amxp_cron_expr_t **cron_expr) |
Frees the previously allocated amxp_cron_expr_t structure. More... | |
int | amxp_cron_init (amxp_cron_expr_t *cron_expr) |
Initializes an amxp_cron_expr_t structures to every second. More... | |
void | amxp_cron_clean (amxp_cron_expr_t *cron_expr) |
Resets the amxp_cron_expr_t structure to the initialized state. More... | |
int | amxp_cron_parse_expr (amxp_cron_expr_t *target, const char *expression, const char **error) |
Allocates and initializes an amxp_cron_expr_t structures and parses the given cron expression. More... | |
int | amxp_cron_build_weekly (amxp_cron_expr_t *target, const char *time, const char *days_of_week) |
Builds a weekly cron expression that is triggered at a certain time on certain days of the week. More... | |
int | amxp_cron_prev (const amxp_cron_expr_t *expr, const amxc_ts_t *ref, amxc_ts_t *next) |
Calculates the previous trigger time for a parsed cron expression. More... | |
int | amxp_cron_next (const amxp_cron_expr_t *expr, const amxc_ts_t *ref, amxc_ts_t *next) |
Calculates the next trigger time for a parsed cron expression. More... | |
int64_t | amxp_cron_time_until_next (const amxp_cron_expr_t *expr, bool local) |
Calculates the time in seconds until next trigger of a parsed cron expression occurs. More... | |
#define _GNU_SOURCE |
Definition at line 56 of file amxp_cron.c.
#define CRON_CF_ARR_LEN 7 |
Definition at line 87 of file amxp_cron.c.
#define CRON_CF_DAY_OF_MONTH 4 |
Definition at line 83 of file amxp_cron.c.
#define CRON_CF_DAY_OF_WEEK 3 |
Definition at line 82 of file amxp_cron.c.
#define CRON_CF_HOUR_OF_DAY 2 |
Definition at line 81 of file amxp_cron.c.
#define CRON_CF_MINUTE 1 |
Definition at line 80 of file amxp_cron.c.
#define CRON_CF_MONTH 5 |
Definition at line 84 of file amxp_cron.c.
#define CRON_CF_SECOND 0 |
Definition at line 79 of file amxp_cron.c.
#define CRON_CF_YEAR 6 |
Definition at line 85 of file amxp_cron.c.
#define CRON_MAX_DAYS_OF_MONTH 32 |
Definition at line 76 of file amxp_cron.c.
#define CRON_MAX_DAYS_OF_WEEK 8 |
Definition at line 75 of file amxp_cron.c.
#define CRON_MAX_HOURS 24 |
Definition at line 74 of file amxp_cron.c.
#define CRON_MAX_MINUTES 60 |
Definition at line 73 of file amxp_cron.c.
#define CRON_MAX_MONTHS 13 |
Definition at line 77 of file amxp_cron.c.
#define CRON_MAX_SECONDS 60 |
Definition at line 72 of file amxp_cron.c.
|
static |
Definition at line 333 of file amxp_cron.c.
|
static |
Definition at line 262 of file amxp_cron.c.
|
static |
Definition at line 304 of file amxp_cron.c.
|
static |
Definition at line 89 of file amxp_cron.c.
|
static |
Definition at line 424 of file amxp_cron.c.
|
static |
Definition at line 210 of file amxp_cron.c.
|
static |
Definition at line 180 of file amxp_cron.c.
|
static |
Definition at line 147 of file amxp_cron.c.
|
static |
Definition at line 224 of file amxp_cron.c.
|
static |
Definition at line 135 of file amxp_cron.c.
|
static |
Definition at line 118 of file amxp_cron.c.