in EPL, I need to make sure that both alarms happen at the same date before issuing some logic but I am facing an issue: Apparently APAMA uses Unix timestamp (milliseconds since epoch) and it doesn’t use the ISO timestamp
since in EPL we don’t have something like “datetime” like in python to do the needed date trip/split, how can we get the date where this event/alarm happened in EPL?
ok I will test daysSinceEpoch using the following EPL code snipet:
//////////////////////////////////
using com.apama.correlator.timeformat.TimeFormat;
monitor DaysSinceEpochExample {
action onload() {
on all Alarm() as a1 {
float days := TimeFormat.daysSinceEpoch(a1.time);
//////////////////////
and then I can compare the days of a1 to the days of a2, if the same then the alarms happened at the same day, is it a correct approach?
Yes, in general, but daysSinceEpoch returns an integer not a float. Can you guarantee that both timestamps are in the same timezone? If not going with daysSinceEpochUTC may be safer. (Update: if you get the timestamp from “currentTime” or from an alarm, event, or measurement, you should be fine).
yes both alarms from the same worker tag → Same timezone
many thanks for your input
and by the way, is there a way to import the “duration” object that we usually use in analytics builder to EPL? Duration contains a very useful input called RESET and we reset it every end of day to avoid measuring the time between 2 alarms from different days