/** * List all alarms near $date. * * @param integer $date The unix epoch time to check for alarms. * * @return array An array of tasks that have alarms that match. */ public function listAlarms($date) { if (!$this->tasks->count()) { $result = $this->retrieve(0); } $alarms = array(); $this->tasks->reset(); while ($task = $this->tasks->each()) { if ($task->alarm && ($due = $task->getNextDue()) && $due->timestamp() - $task->alarm * 60 <= $date) { $alarms[$task_id] = $task; } } return $alarms; }