Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to have somthing like Timer functionality in C.
How should I implement this?

Funcationality I am looking at is I will call Function2 from Function1().
Then Function2()
C++
void Function1()
{


  Function2(int time);
  ----
  ---
  
} 


void Function2(int T)
{

// wait for time T, and proceed with the below 
//Other statements in Fucntion1 after Funcation2() call should not be pause, 
// till Function2() returns 
---
---
--

}


What I have tried:

I tired call the function directly from Function1()
Posted
Updated 18-Jan-18 1:56am

Quote:
/ wait for time T, and proceed with the below

This is usually accomplished with a OS dependant sleep function. For instance you have Sleep function (Windows)[^] on Windows and usleep(3) - Linux man page[^] on Linux.
 
Share this answer
 
Comments
ptr_Electron 18-Jan-18 7:31am    
I am using on Android
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900