Time....days
hello,
I have to make a program that pop ups evey 3 days...
How would you check how many days have passed??
i thought something like y*365+m*(number of the days in the month)+d....but sometimes we have leap years and stuff...that can mess upo the timing....
any suggestions please?
thanks
First of all, if this program is supposed to be able to quit and then run again, it needs to save the time when it was shut off. Simply, check the date every second. If the date changes from one day to the next, increment a variable that tells how many days have gone by. When the variable reaches 3, 3 days have gone by. Make sure to save the states if the program isn''t on 24-7.
=======================================
A man with no head is still a man.
A head with no man is plain freaky.
=======================================
A man with no head is still a man.
A head with no man is plain freaky.
The easy answer is to use the scheduler service... The harder one is to to use OS api''s. Store the date (which is generally something like the number of milliseconds since the year ~1700). Then at long intervals(like sleep(10000) check the current time vs the recorded time + 3 days (in milliseonds). If the old time + 3 days is a bigger number than the current time you have 3 elapsed days.
To repeat, just zero the timer and start again...Not super accurate but you don''t have to worry about dates.
If you need more help email me at thegimp.1@email.com and I''ll post my source for something that deletes file older than 7 days, very similar concept...
gimp
To repeat, just zero the timer and start again...Not super accurate but you don''t have to worry about dates.
If you need more help email me at thegimp.1@email.com and I''ll post my source for something that deletes file older than 7 days, very similar concept...
gimp
Chris Brodie
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement