• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - Automation
  • Cron
  • 5.0.0

Cron Class

(Automation::Cron)

The Cron component is a time-based generator, that changes its output based on schedule configuration properties similar to crontab of Unix-like operating systems. More...

Header: #include <Cron>
Inherits: CDPComponent
  • List of all members, including inherited members

Reimplemented Public Functions

virtual void Create(const char *fullName) override
virtual void ProcessNull() override
  • 92 public functions inherited from CDPComponent
  • 39 public functions inherited from CDPObject
  • 49 public functions inherited from CDPBaseObject
  • 27 public functions inherited from CDP::StudioAPI::CDPNode
  • 22 public functions inherited from CDP::StudioAPI::ICDPNode

Protected Functions

void CalculateNextEvent(void)
int MessageRestart(void *message)
void SetNextEventTimestampString(void)

Reimplemented Protected Functions

virtual void CreateModel() override
  • 12 protected functions inherited from CDPComponent
  • 15 protected functions inherited from CDPObject
  • 1 protected function inherited from CDP::StudioAPI::CDPNode

Additional Inherited Members

  • 92 public functions inherited from CDPComponent
  • 39 public functions inherited from CDPObject
  • 49 public functions inherited from CDPBaseObject
  • 27 public functions inherited from CDP::StudioAPI::CDPNode
  • 22 public functions inherited from CDP::StudioAPI::ICDPNode
  • 2 static public members inherited from CDPComponent
  • 6 static public members inherited from CDPObject
  • 1 static public member inherited from CDPBaseObject
  • 42 protected variables inherited from CDPComponent
  • 9 protected variables inherited from CDPObject
  • 10 protected variables inherited from CDPBaseObject

Detailed Description

The Cron component is a time-based generator, that changes its output based on schedule configuration properties similar to crontab of Unix-like operating systems.

Schedule Configuration Properties

PropertyDescription
SecScheduled second (0-59)
MinScheduled minute (0-59)
HourScheduled hour (0-23)
DayScheduled day of the month (1-31)
MonScheduled month (1-12)
DoWScheduled day of the week (1 or MON - Monday, 6 or SAT - Saturday, 0 or 7 or SUN - Sunday)

In addition to simple value every schedule configuration property can be also have a special form

Special formMeaning scheduled at
*Every value
*/N (eg. */5)Every N-th value (eg. 0,5,15 etc)
?Despite of the value (can be used in Day when specifying DoW or vice versa)
Comma separated list of digitsAll listed values
Dash separated range (eg. 1-4)All values in the range (eg. 1, 2, 3 and 4)

Signals

SignalDescription
OutputScheduled output (changes its value at every event)
NextTimestampTimestamp of the next scheduled output change (in format "DOW MON DD HH:MM:SS YYYY")
SecondsLeftTime left to the next scheduled output change (in seconds)

Messages

MessageDescription
CM_SUSPENDSuspend the scheduler.
CM_ACTIVATEResume the scheduler.
RestartRe-schedule (ie. re-calculate the next event timestamp).

Note: Note that you have to send Restart message after changing schedule configuration properties if you need to take them into effect immediately (before already calculated next event is reached).

Cron Schedule Configuration Examples

SecMinHourDayMonDowSchedule
******After every second
*/15*1-4***Every night during 01:00:00 - 04:59:45, after every 15 seconds
0*/22,4***Every night between 02:00:00 - 02:58:00 and 04:00:00 - 04:58:00, after every 2 minutes
007?*MON-FRIEvery weekday (eg. from Monday to Friday) at 07:00:00
0302330*/3?Every third month on day 30 at 23:30:00
001?1MONOnce a year at first Monday in January at 01:00:00

Member Function Documentation

[protected] void Cron::CalculateNextEvent(void)

[override virtual] void Cron::Create(const char *fullName)

[override virtual protected] void Cron::CreateModel()

[protected] int Cron::MessageRestart(void *message)

[override virtual] void Cron::ProcessNull()

[protected] void Cron::SetNextEventTimestampString(void)

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top