Comparando pontos no tempo

Verifique se um ponto no tempo ocorre antes, depois ou ao mesmo tempo que outro ponto no tempo.

Use os operadores a seguir para comparar pontos no tempo:
  • is after e is after or the same as.
  • is before e is before or the same as.
  • is at the same time as.

Por exemplo, the arrival time of 'the first flight' is before the departure time of 'the second flight'.

A regra a seguir verifica se há pelo menos uma hora antes da chegada do primeiro voo e a partida do segundo voo.

definições
    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';
se 
    the scheduled departure time of 'flight2' is before 1 hour after the scheduled arrival time of 'flight1'
então
    print "Less than 1 hour of transit time";

Comparação de um ponto no tempo e um horário do dia

As informações de fuso horário são armazenadas no ponto no tempo. Por exemplo, em um evento, as informações de fuso horários estão no registro de data e hora.

A regra a seguir verifica se um evento de compra ocorreu durante a tarde, no fuso horário a partir do qual o evento provém.

when a purchase event occurs
    where the time of day of this purchase event is after or the same as 12:00 PM
então
    print "Afternoon purchase.";

Comparação de instantes de tempo

A regra a seguir compara o instante de tempo de dois pontos no tempo, independentemente de seus fusos horários.

when a flight departure event occurs
    where this flight departure event is after the scheduled departure time of 'the flight'
então
    print "The flight's departure was late";
A regra a seguir verifica se a partida do voo ocorre exatamente ao mesmo tempo que o horário de partida planejado.
Importante: Os operadores is at the same time as verificam o instante de tempo até os segundos. A regra retorna false se o horário não for igual até o segundo exato.
when a flight departure event occurs
    where this flight departure event is at the same time as the scheduled departure time of 'the flight'
então
    print "The flight departed on time";

Comparação de eventos

A regra a seguir verifica se o reagendamento de um voo ocorre antes que as malas sejam carregadas no avião.

when a flight rescheduled event has occurred 5 minutes ago, called 'the flight rescheduled'
definições
    set 'the bag loaded' to a bag loaded event;
se
    'the flight rescheduled' is after 'the bag loaded'
então
    print "The flight is rescheduled, please unload the bags from the plane";