CodebyCR / TimedAction

An easy, state-of-the-art timing Framework.
MIT License
0 stars 0 forks source link

Add designated initializers for complex Cron expressions #7

Closed CodebyCR closed 1 year ago

CodebyCR commented 1 year ago

This kind of initialisation can be very confusing.

auto some_cron = Cron("0 30 */2 1 3 * 2021-2023");

The way with a designated initializers is much better:

    auto someCron = Cron({.second = "0",
                          .minute = "30",
                          .hour = "*/2",
                          .dayOfMonth = "15",
                          .month = "*/2",
                          .weekday = "*",
                          .year = "2023-2024"});
CodebyCR commented 1 year ago

Fixed with a 'CronCapsule' struct.