mariusbancila / croncpp

A C++11/14/17 header-only cross-platform library for handling CRON expressions
MIT License
236 stars 68 forks source link

Example does appear to work/parse? #14

Open harlowja opened 3 years ago

harlowja commented 3 years ago

I was trying some of the examples and saw the following happen:

Trying: 0 15 10 L * ?
terminate called after throwing an instance of 'cron::bad_cronexpr'
  what():  stoul
Aborted (core dumped)

Program code (nothing crazy):

#include "croncpp.h"

#include <chrono>
#include <iostream>
#include <string>

int main(int argc, char** argv) {
    std::string c = argv[1];
    std::cout << "Trying: "<< c << "\n";
    auto cexpr = cron::make_cron(c);
    auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
    auto next = cron::cron_next(cexpr, now);
    std::cout << next << "\n";
    return 0;
}

I also tried with the various oracle and quartz traits, but didn't seem to work.

Perhaps remove from the README.md if this format doesn't work?

mariusbancila commented 3 years ago

You are correct, L and W are not currently supported and the readme.md is misleading about this.