I would like to subtract current_time with previously_saved_time and check if it’s bigger then wait_time. wait time should be an int. Can someone give me a simple example? In other words:
if ((current_time - previously_saved_time) > wait_time) {
do something;
}
What you have is exactly what you need, other than replacing
do somethingwith some actual code.For example, this program waits three seconds:
It simply loops in the
whilestatement until the difference between the base time and the current time is three or more (there are almost certainly better ways to wait forNseconds, this is just meant to illustrate the calculation).