C++ function that do something a number of specified times in a period of 24 hours

267 Views Asked by At

I am trying to implement a function that tells the computer to sample some data a given number of times per day. Let say for example i want to sample a sensor every 30 second over a time period of 24 hours. And Another sensor maybe every 120 second over a time period of 24 hours.

24 hours = 86400 seconds.

I have a counter running that contains the elapsed time in seconds.

Is there a way to implement a C++ conditional branch/function that achieves this in an elegant way?

0

There are 0 best solutions below