{
long currentEventTime = eventsToSend.first().getSendTime();
// check whether time has increased. Cannot go backwards due to checks elsewhere
if (currentEventTime > lastEventTime)
{
this.sender.sendEvent(null, new CurrentTimeEvent(lastEventTime));
lastEventTime = currentEventTime;
}
sendFirstEvent();
}
// send final time processTimeEvent
this.sender.sendEvent(null, new CurrentTimeEvent(lastEventTime));
}
else
{
// watch time and send events to catch up
while(!eventsToSend.isEmpty() && eventsToSend.first().getSendTime() <= currentTime - startTime)