Timer

Hi .

i tried to make program that
do {
open a .exe (and i did it)
then count 30 mints or so .. i know time in counter in ms
and after this 30 mints the count stop and the .exe closed ...

}


what i need .. i need some hints or code about the time counter .. i know there's alot of types but i tried to search i couldn't find one close the .exe application after the count finish .
thanks.
Last edited on
Could you provide the code that you have already written?
to be honest .. i didn't write a full code yet .. till now i am trying to get some information about how to make count the time then close the app directly .. then i will make it into loop
and i think there's no need to my code to know how to make the time count then close the exe which the code opened it
thanks for reply :)
SFML has a built in timer, so you can use in a while loop.
1
2
3
4
sf::Clock timePast;
while (timePast.getElapsedTime() < sf::seconds(1800.f))
{
}
i couldn't include SFML to my codeblocks ... anyways .. this code just for make timer .. not also for closing the app after the time finish ?
then count 30 mints or so .. i know time in counter in ms
and after this 30 mints the count stop and the .exe closed ...


Are you trying to say minutes? I think you are, because mints are these: https://www.hersheys.com/payday/products.aspx

If what you are trying to do is:
Open a file, then put a "timer" on that will "halt" the program for 30 minutes (no idea why you would want to do that) then close your C++ program,the only way I would know to do it is use the Sleep() function

Sleep(1.8e+6); //Would put your program to sleep for 30 minutes...but why my friend?
Last edited on
look i will give example ..

i need the code open ( for example game.exe )
and after 30 mints ( the code close game.exe from task manger or anyway )
thank you for reply :)
sleep will just sleep the program .. i don't want to sleep my program
i want to end the process which i ordered the program to open after 30 mints ..
open game.exe
(timer wait ) >>30 minutes
if ( timer <30 minutes)
{
do nothing
}
else
{
reset timer
close game.exe

}
_____________________________________________________
Timer wait .. i believe that there's a function could make me wait 30 minutes before taking action
and i made if else loop that waiting for the timer to take the action .. if the time < 30 no action
else will reset my timer to 0 ( i don't need it .. but will be good to know ) then the action close.exe .

i want to know how to set the timer ... and how to close the game.exe ..
thanks .
Last edited on
Topic archived. No new replies allowed.