Added code to ensure that code snippets in Readme compile. (#46)

* Update README.md

Added missing stream insertion operator to example.   Also, header files for chrono and thread as well as a missing namespace for literals added.

---------

Co-authored-by: Per Malmberg <PerMalmberg@users.noreply.github.com>
This commit is contained in:
Dr. Nicholas J. Kinar 2025-06-01 02:51:30 -06:00 committed by GitHub
parent aa3d4368d5
commit de143e8b8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,10 +6,16 @@ A C++ scheduling library using cron formatting.
Libcron offers an easy to use API to add callbacks with corresponding cron-formatted strings:
```
#include <libcron/Cron.h>
#include <libcron/CronData.h>
#include <chrono>
#include <thread>
using namespace std::chrono_literals;
libcron::Cron cron;
cron.add_schedule("Hello from Cron", "* * * * * ?", [=](auto&) {
std::cout << "Hello from libcron!" std::endl;
std::cout << "Hello from libcron!" << std::endl;
});
```
@ -19,7 +25,7 @@ To trigger the execution of callbacks, one must call `libcron::Cron::tick` at le
while(true)
{
cron.tick();
std::this_thread::sleep_for(500mS);
std::this_thread::sleep_for(500ms);
}
```