Painless time comparison

I'm attempting to write a script that allows me to find the number of events that are still active. My attempt so far this is not working is below:

int total = 0;
def n = 323423L;

if(doc['startTime'][0] < n && doc['endTime'][0] > n)
{
    total = 1;
}

return total;

What I wish to have is for n to be the current time, and if the start is less than, and the end is greater than, set the total equal to 1.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.