Timer for Minute, Hours & days..
-
Hi..can anybody..suggest me How to make timer for 1. Minute 2. Hours 3. days i.e. User set a time for process to execute after 10 min. then after 10 min. a event is fired & process start running.. this 10 min. can be 10 days... Plz suggest me how to go next..as I didn't find any timer that even deals with min. or hours..even days r too far. evry timer is based on milisecond..that i don't want... I hope u'll help me.. Thanks ---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
-
Hi..can anybody..suggest me How to make timer for 1. Minute 2. Hours 3. days i.e. User set a time for process to execute after 10 min. then after 10 min. a event is fired & process start running.. this 10 min. can be 10 days... Plz suggest me how to go next..as I didn't find any timer that even deals with min. or hours..even days r too far. evry timer is based on milisecond..that i don't want... I hope u'll help me.. Thanks ---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
1000ms = 1sec 60sec = 1min 60mins = 1hour 24hours = 1day 7days = 1week got the point? what's wrong with a timer interval of
(1000 * 60 * 10)
for 10 minutes (just as an example)? You can safely useSetTimer
. There are not "timers for days/minutes" that I'm aware of. regards -
1000ms = 1sec 60sec = 1min 60mins = 1hour 24hours = 1day 7days = 1week got the point? what's wrong with a timer interval of
(1000 * 60 * 10)
for 10 minutes (just as an example)? You can safely useSetTimer
. There are not "timers for days/minutes" that I'm aware of. regardsthanks for reply.. But there must be limit to pass vaue of time in SetTimer function..I'm not sure but that must be 65,000ms this means I can do with 10 min. interval..but when I wish to do with days interval then it would be problem for program to check over & again... do u have any idea.. Thanks..bye sumit_kapoor1980@hotmail.com
-
Hi..can anybody..suggest me How to make timer for 1. Minute 2. Hours 3. days i.e. User set a time for process to execute after 10 min. then after 10 min. a event is fired & process start running.. this 10 min. can be 10 days... Plz suggest me how to go next..as I didn't find any timer that even deals with min. or hours..even days r too far. evry timer is based on milisecond..that i don't want... I hope u'll help me.. Thanks ---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
You could use a couple of
CTime
objects to keep track of the start and current time. The start time is set when your program starts (you can do this in your dialog'sOnInitDialog()
handler). Set a timer to fire every second (since this is the resolution you want to honor) and in yourOnTimer()
handler, do the following:CTime tmNow = CTime::GetCurrentTime();
int nElapsedSeconds = tmNow.GetTime() - tmStart.GetTime();
if (nElapsedSeconds > ...) {
// Time to do something...
}/ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com
-
thanks for reply.. But there must be limit to pass vaue of time in SetTimer function..I'm not sure but that must be 65,000ms this means I can do with 10 min. interval..but when I wish to do with days interval then it would be problem for program to check over & again... do u have any idea.. Thanks..bye sumit_kapoor1980@hotmail.com
Sumit Kapoor wrote: But there must be limit to pass vaue of time in SetTimer function..I'm not sure but that must be 65,000ms Nope, it's about 4 billion ms...
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Hi..can anybody..suggest me How to make timer for 1. Minute 2. Hours 3. days i.e. User set a time for process to execute after 10 min. then after 10 min. a event is fired & process start running.. this 10 min. can be 10 days... Plz suggest me how to go next..as I didn't find any timer that even deals with min. or hours..even days r too far. evry timer is based on milisecond..that i don't want... I hope u'll help me.. Thanks ---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
the simple code is this CString m_szCurrentTime; CTime time=CTime::GetCurrentTime(); m_szCurrentTime.Format("%d : %d : %d",time.GetHour(),time.GetMinute(),time.GetSecond()); I Think It will Work ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk
-
Hi..can anybody..suggest me How to make timer for 1. Minute 2. Hours 3. days i.e. User set a time for process to execute after 10 min. then after 10 min. a event is fired & process start running.. this 10 min. can be 10 days... Plz suggest me how to go next..as I didn't find any timer that even deals with min. or hours..even days r too far. evry timer is based on milisecond..that i don't want... I hope u'll help me.. Thanks ---Sumit Kapoor--- sumit_kapoor1980@hotmail.com