Printing time information
You can print time points, time periods, calendar durations, and absolute durations when you generate messages.
The string representation of time points, time periods, calendar durations, and absolute durations is based on the extended form that is defined in the ISO 8601 standard.
Calendar durations can involve years, months, days, hours, minutes, and seconds. Absolute durations can involve the regular units hours, minutes, and seconds. A day is not a regular unit as it might or might not include a leap second.
Example
The following rule prints a message that includes two time points, a time period, a calendar duration, and an absolute duration:
when a project launch delay event occurs
definitions
set 'project start time' to the delay of this project launch delay event after the planned start time of 'the project' ;
set 'project end time' to the project duration of 'the project' after 'project start time' ;
then
print "Project start (Time Point): " + 'project start time' ;
print "Project end (Time Point): " + 'project end time' ;
print "Project period (Time period): " + the period between 'project start time' and 'project end time' ;
print "Project duration (Calendar Duration): " + the project duration of 'the project' ;
print "Project duration (Absolute Duration): " + the duration between 'project start time' and 'project end time' ;
This rule might print the following statement:
Project start (Time Point): 2014-02-21T00:00+01:00[Europe/Monaco]
Project end (Time Point): 2015-05-31T00:00+02:00[Europe/Monaco]
Project period (Time period):
2014-02-21T00:00+01:00[Europe/Monaco]/2015-05-31T00:00+02:00[Europe/Monaco]
Project duration (Calendar Duration): P1Y3M8D
Project duration (Absolute Duration): PT11159H
Where T indicates the beginning of the time element. [Europe/Monaco] is the solution time zone.
In the last two lines of code, P stands for duration, Y for year, M for month, D for day and H for hour.