An efficient event ordering algorithm that extends the lifetime of wireless actor and sensor networks