Comparing time points
Check that a time point is before, after, or at the same time as another time point.
- is after and is after or the same as.
- is before and is before or the same as.
- is at the same time as.
For example, the arrival time of 'the first flight' is before the departure time of 'the second flight'.
The following rule checks that there is at least an hour before the arrival of the first flight and the departure of the second flight.
definitions
set 'flight1' to a flight in the flights of 'the customer';
set 'flight2' to a flight in the flights of 'the customer'
where the scheduled departure time of this flight is after the scheduled arrival time of 'flight1';
if
the scheduled departure time of 'flight2' is before 1 hour after the scheduled arrival time of 'flight1'
then
print "Less than 1 hour of transit time";
Comparison of a time point and a time of day
The time zone information is stored in the time point. For example, in an event, the time zone information is in the time stamp.
The following rule checks if a purchase event occurred in the afternoon, in the time zone where the event comes from.
when a purchase event occurs
where the time of day of this purchase event is after or the same as 12:00 PM
then
print "Afternoon purchase.";
Comparison of time instants
The following rule compares the time instant of two time points independently of their time zones.
when a flight departure event occurs
where this flight departure event is after the scheduled departure time of 'the flight'
then
print "The flight's departure was late";
when a flight departure event occurs
where this flight departure event is at the same time as the scheduled departure time of 'the flight'
then
print "The flight departed on time";
Comparison of events
The following rule checks whether the rescheduling of a flight happens after the bags are loaded on the plane.
when a flight rescheduled event has occurred 5 minutes ago, called 'the flight rescheduled'
definitions
set 'the bag loaded' to a bag loaded event;
if
'the flight rescheduled' is after 'the bag loaded'
then
print "The flight is rescheduled, please unload the bags from the plane";