Working with Time
I'll be making a notifier program, which'll allow the user to set notifications at certain times and when the time comes the application will alert the user.
How should I go about working with time? I already know about <ctime>, but is there something better more reliable?
You'll probably want to use some platform specific functionality. What OS/compiler are you using?
>>but is there something better more reliable?
there are better functions, depending on what you want to do. I'd suggest that the functions in <ctime> are quite adequate for your purpose, it doesn't need millisecond accuracy.
You could use the os's scheduler facilities to schedule events to occur at specific times, I know both MS-Windows and *nix have them.
I'm working with Windows and VC++.
Well i just briefly looked into the Timer, but you can set it so it alerts the program every x miliseconds, now the program might have mor than 1 alerts set.
Any other suggestions?
And also if the message queue is backed up with messages the WM_TIMER is delayed because its pushed back on the Message Queue,
I was thinking of starting a thread for every alert, and doing a Sleep() for the required amount of seconds/minutes, but that doesn't seem like a smart thing to do?
It would be better than having a loop that continuously checked to see if any of the events were done.
Having a loop is never better than anything else.
WM_TIMER is not realistically delayed more than a fraction of a second, and even that is only under heavy system load.