Skip to content

croncpp returning time in the past near the DST #32

@enrico-samknows

Description

@enrico-samknows

Hi, I've found a strange case which fails:

#include "include/croncpp.h"
#include <iostream>

int main() {

   try {

     setenv("TZ", "CET-1CEST,M3.5.0,M10.5.0/3", 1);
     tzset();

     auto cron_string = std::string{ "30 55 5,11,17 * * *" };
     auto cron = cron::make_cron(cron_string);

     std::time_t now = 1679777644;
     std::time_t next = cron::cron_next(cron, now);

     std::cout << "Now:  " << now << std::endl;
     std::cout << "Next: " << next << std::endl;

  }
  catch (cron::bad_cronexpr const & ex)
  {
    std::cerr << ex.what() << '\n';
  }

}

prints:

Now:  1679777644
Next: 1679720130

where next < now.
Am I doing something wrong with the invocation here?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions