Skip to content

Commit

Permalink
Add mgos_cron_get_next_invocation()
Browse files Browse the repository at this point in the history
Calculate the next fire date of a cron job after the specified date

Closes cesanta/mos-libs#12
Fixes cesanta/mos-libs#8

CL: cron: Add mgos_cron_get_next_invocation()

PUBLISHED_FROM=c34804d354c2e3a779ffc917858714342676df66
  • Loading branch information
Deomid Ryabkov authored and cesantabot committed Aug 16, 2018
1 parent fd6a685 commit 4b27315
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/mgos_cron.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <stdbool.h>
#include <stdint.h>
#include <time.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -56,6 +57,11 @@ typedef void (*mgos_cron_callback_t)(void *user_data, mgos_cron_id_t id);
mgos_cron_id_t mgos_cron_add(const char *expr, mgos_cron_callback_t cb,
void *user_data);

/*
* Calculate the next fire date after the specified date.
*/
time_t mgos_cron_get_next_invocation(mgos_cron_id_t id, time_t date);

/*
* Returns whether the given string is a valid cron expression or not. In case
* of an error, if `perr` is not NULL, `*perr` is set to an error message; it
Expand Down

0 comments on commit 4b27315

Please sign in to comment.