Apama 10.15.5 | Developing Apama Applications | Developing Apama Applications in Java | Defining Event Expressions | Defining advanced event expressions | Specifying the timer operators | Working with absolute time
 
Working with absolute time
The final temporal operator is the at operator. This operator allows you to express temporal activity with regards to absolute time.
The at operator allows triggering of a timer:
*At a specific time; for example, at 12:30pm on April, 5th.
*Repeatedly with regards to the calendar when used in conjunction with the all operator, across seconds, minutes, hours, days of the week, days of the month, and months; for example, on every hour, or on the first day of the month, or every 10 minutes past and 40 minutes past.
Important: 
Triggering using the at operator always uses the time zone in which the correlator is running.
The syntax is as follows:
at(minutes, hours, days_of_the_month, month, days_of_the_week [, seconds])
where the last operand, seconds, is optional.
Valid values for each operand are as follows:
Timer operand
Values
minutes
0 to 59, indicating minutes past the hour.
hours
0 to 23, indicating the hours of the day.
days_of_the_month
1 to 31, indicating days of the month. For some months only 1 to 28, 1 to 29 or 1 to 30 are valid ranges.
month
1 to 12, indicating months of the year, with 1 corresponding to January
days_of_the_week
0 to 6, indicating days of the week, where 0 corresponds to Sunday.
seconds
0 to 59, indicating seconds past the minute.
The operator can be embedded within an event expression in a manner similar to the wait operator. If used outside the scope of an all operator it will trigger only once, at the next valid time as expressed within its elements. In conjunction with an all operator, it will trigger at every valid time.
The wildcard symbol (*) can be specified to indicate that all values are valid, that is
at(5, *, *, *, *)
would trigger at the next five minutes past the hour, while
all at(5, *, *, *, *)
would trigger at five minutes past each hour (that is, every day, every month).
Whereas,
all at(5, 9, *, *, *)
would trigger at 9:05am every day.
However,
all at(5, 9, *, *, 1)
would trigger at 9:05am only on Mondays, and never on any other weekday. This is because the effect of the wildcard operator is different when applied to the days_of_the_week and the days_of_the_month elements. This is due to the fact that both specify the same entity. The rule is therefore as follows:
*As long as both elements are set to wildcard, then each day is valid.
*If either of the days_of_the_week or the days_of_the_month elements is not a wildcard, then only the days that match that element will be valid. The wildcard in the other element is effectively ignored.
*If both the days_of_the_week and the days_of_the_month elements are not a wildcard, then the days valid will be the days which match either. That is, the two criteria are or, not and.
A range operator (:) can be used with each element to define a range of valid values. For example
all at(5:15, *, *, *, *)
would trigger every minute from 5 minutes past the hour till 15 minutes past the hour.
A divisor operator (/x) can be used to specify that every xth value is valid. Therefore
all at(*/10, *, *, *, *)
would trigger every ten minutes, that is, at 0, 10, 20, 30, 40 and 50 minutes past every hour.
If you wish to specify a combination of the above operators you must enclose the element in square brackets ([]), and separate the value definitions with a comma (,). For example,
all at([*/10,30:35,22], *, *, *, *)
indicates as following values for minutes to trigger on: 0,10, 20, 22, 30, 31, 32, 33, 34, 35, 40 and 50.
A further example,
all at(*/30,9:17,[*/2,1],*,*)
would trigger every 30 minutes from 9am to 5pm on even numbered days of the month as well as specifically the first day of the month.