시점 및 지속 기간 비교
시점 및 지속 기간을 비교하여 시점 전후의 특정 순간에 발생하는 일을 테스트합니다.
다음 연산자를 사용하여 시점 및 지속 기간을 비교할 수 있습니다.
- <duration> before <date>
- <duration> after <date>
시점을 일반 시간 스케일의 지속 기간과 비교할 수 있습니다.
예를 들어, 정확히 구매 이벤트 시간 7일 전의 시점은 다음 방법 중 하나로 표현될 수 있습니다.
- 7 days before 'the purchase event'
- 1 week before 'the purchase event'
시점을 비정규 시간 스케일의 지속 기간과 비교할 수 있습니다. 예: 3 months before the launch date of 'the product'. 제품이 2013년 2월 14일에 시작된 경우, 이 규칙은 2012년 11월 14일을 리턴합니다.
달력 기간의 보다 복잡한 양식을 빼거나 더할 수도 있습니다. 예: 2 months 1 week 2 days before the launch date of 'the product'
다음 규칙은 구매 이벤트가 항공편 출발 이후 2시간이 지나서 발생하는지 여부를 확인합니다.
when a purchase event occurs
definitions
set 'the departure time' to a flight departure event;
if this purchase event is after 2 hours after 'the departure time'
then print "A passenger made a purchase more than 2 hours after the flight departure.";
시점은 절대 지속 기간으로 지정된 다른 시점에 대한 시간 간격에 의해 정의될 수도 있습니다.