How to Implement a Time Service
Use a singly or doubly linked list, or a priority queue (priority_queue). Each element in the queue is a timer object. A timer object holds the time difference measured from a standard point in time (when the program started running) — the later a timer is supposed to fire, the larger this value — along with the trigger event type. If you only use a linked list, you have to re-sort after every insertion. With a priority queue the insertion position is handled automatically, so I figure the priority queue should work better, though I still need to test it. On every heartbeat (the server thread loop), the time service’s OnTicker function is called. It checks the time value of the first timer in the queue, and if the current time difference has reached or passed it, the timer is popped out and its trigger event is called. Right now there are two questions still unanswered:

I used to always download APEs and burn my own discs, but this time was different — by chance I heard a song called “Flowers on the Sea”, and I bought the CD without a second thought!