title: Time driven events architecture
body: <p>I am looking into Time driven events and I can't seem to figure out how to this would be done without using an excessive amount of CPU constantly.</p>
  
  <pre><code>array events;
  events[1] = [id:1,time:1440589943,event:happend];
  While(running)
  {
      loop over events
          if(currentTime &gt;= eventTime)
               fireEvent()
  }
  </code></pre>
  
  <p>This seems like the most basic event handler I can come up with but it would I think consume alot of CPU constantly without really doing anything really.</p>
  
  <p>So the question basically is: How do time driven events in other any languages handle time driven events? Do they constantly check if one is ready to be fired? Do they use a clever scheduling mechanic?</p>
  
  <p>Thanks in advance.</p>