PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
cron.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <time.h>
#include <pbl/util/list.h>

Data Structures

struct  pbl_cron_job
 Cron job. More...
 
union  pbl_cron_job.__unnamed13__
 
struct  pbl_cron_job.__unnamed13__.__unnamed15__
 

Macros

#define PBL_CRON_MINUTE_ANY   (-1)
 Any minute.
 
#define PBL_CRON_HOUR_ANY   (-1)
 Any hour.
 
#define PBL_CRON_MDAY_ANY   (-1)
 Any day of the month.
 
#define PBL_CRON_MONTH_ANY   (-1)
 Any month.
 
#define PBL_CRON_WDAY_SUNDAY   (1 << 0)
 Sunday in a day of the week mask.
 
#define PBL_CRON_WDAY_MONDAY   (1 << 1)
 Monday in a day of the week mask.
 
#define PBL_CRON_WDAY_TUESDAY   (1 << 2)
 Tuesday in a day of the week mask.
 
#define PBL_CRON_WDAY_WEDNESDAY   (1 << 3)
 Wednesday in a day of the week mask.
 
#define PBL_CRON_WDAY_THURSDAY   (1 << 4)
 Thursday in a day of the week mask.
 
#define PBL_CRON_WDAY_FRIDAY   (1 << 5)
 Friday in a day of the week mask.
 
#define PBL_CRON_WDAY_SATURDAY   (1 << 6)
 Saturday in a day of the week mask.
 
#define PBL_CRON_WDAY_WEEKDAYS
 Monday to Friday.
 
#define PBL_CRON_WDAY_WEEKENDS   (PBL_CRON_WDAY_SUNDAY | PBL_CRON_WDAY_SATURDAY)
 Saturday and Sunday.
 
#define PBL_CRON_WDAY_ANY   (PBL_CRON_WDAY_WEEKENDS | PBL_CRON_WDAY_WEEKDAYS)
 Every day of the week.
 

Typedefs

typedef void(* pbl_cron_job_cb_t) (struct pbl_cron_job *job, void *data)
 Callback of a cron job.
 

Functions

void pbl_cron_init (void)
 Initialize the cron subsystem.
 
void pbl_cron_handle_clock_change (int32_t utc_time_delta, int32_t gmt_offset_delta, bool dst_changed)
 Adjust the scheduled jobs after a wall clock change.
 
void pbl_cron_handle_clock_correction (void)
 Catch up with a small correction of the wall clock.
 
time_t pbl_cron_job_schedule (struct pbl_cron_job *job)
 Schedule a job, or reschedule it if already scheduled.
 
void pbl_cron_job_schedule_at (struct pbl_cron_job *job, time_t utc_time)
 Schedule a job at a fixed time, or reschedule it if already scheduled.
 
time_t pbl_cron_job_schedule_after (struct pbl_cron_job *job, struct pbl_cron_job *new_job)
 Schedule a job to run right after another one.
 
bool pbl_cron_job_unschedule (struct pbl_cron_job *job)
 Unschedule a job.
 
bool pbl_cron_job_is_scheduled (struct pbl_cron_job *job)
 Check whether a job is scheduled.
 
time_t pbl_cron_job_get_execute_time (const struct pbl_cron_job *job)
 Compute the next execution time of a job from the current time.
 
time_t pbl_cron_job_get_execute_time_from_epoch (const struct pbl_cron_job *job, time_t local_epoch)
 Compute the next execution time of a job from a given time.