Hello everyone,
I'm trying to make a calender reminder program where it acts like a alarm clock.
For eg..
1). User enters the input date and event name called "Hello".
Lets say 15 Oct 2011. (Current date is 2 July 2011)
2). When the date reach 15 Oct 2011, an alert will be shown to the user.
Any tips for me to kick start the program like reference or something. I tried to look everywhere but to no avail. Just any for me to reference will do thx!!
Use strftime() to get number of seconds elapsed since midnight on January 1, 1970, then compare that with time() every second, no need for Boost depedency.
Thx modran.
But I wanna let the user set their DD/MM/YYYY than the time.
After that when it reached the real date it will cout an alert on the main menu.
To inform them about the event they set the previous time.
Pardon me for my english..
Get the date from user as string and pass that to strftime(). It will return number of seconds elapsed since midnight on January 1, 1970 until that date, NOT since current date, then keep compared with time() which also returns number of seconds elapsed since midnight on January 1, 1970, but until the real date.
sorry for interupting...but asking this just out of curiosity...how can we track the date when the program is not running...i mean you just cant keep your system running till that date or to be more precise how can you make a program run even if the system is not working??
2). When program is switch on, it will pull the information from the textfile and put it into time settings in whichever you might call it. Then the "alarm" will be at a switch "ON" state.
3). When program is switched off. It will be at "OFF" state. The date is still kept in the textfile.
4). When it switch on it goes back to step 2.
I dunno whether my analysis is correct or wrong. Even if it does, it seems kinda hard to work on it. I learned my C++ for 4-5 months, so my knowledge wasn't that good enough, sorry..
sorry for interupting...but asking this just out of curiosity...how can we track the date when the program is not running...i mean you just cant keep your system running till that date or to be more precise how can you make a program run even if the system is not working??
In Unix, there is a daemon (a forever-running program) for calendar perhaps? I know cron has a daemon so the concept should also applies.
This daemon help to note down your scheduled events to trigger and when the time is up, it will fire the event.
If you intend to write your program as a daemon e.g a Sockets Server, you need some API to help you achieve that.