Skip to content

Commit

Permalink
Add basic scheduler explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Feb 22, 2022
1 parent f4fb07a commit 1e6c684
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/user-manual/cron-basic-schedule.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.. _cron_basic_schedule:

CRON basic schedule
===================

The idea behind cron is to schedule tasks at specific interval or period of time.

Library does not provide generic scheduler that would do that automatically for you,
instead user should manually implement custom scheduler to periodically check and schedule should cron execute or not.

.. tip::
A check should be performed at least at minimum cron granularity, that being ``1 second`` in the current revision.

Basic example is very simple and does the following:

* Parses cron defined by user with :cpp:`lwdtc_cron_parse` function
* Reads system time periodically (example was tested under *Windows* environment)
* It checks if cron is valid for execution each time new time changes versus previous check
* It executes task

.. literalinclude:: ../../examples/cron_basic.c
:language: c
:linenos:
:caption: Basic CRON example with parser
1 change: 1 addition & 0 deletions docs/user-manual/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ User manual
:maxdepth: 2

cron
cron-basic-schedule
cron-dt-range

0 comments on commit 1e6c684

Please sign in to comment.