time dependent loops

Hi;
I was wondering how I can create loops that work according to the system time.
Just as an example I want my code to perform a task at 8:00 AM repeat this task every 15 mins till 9:00AM.

example pseudo:

Function A(time_t Start, int Interval, time_t End)
int numExec= (End-Start)/Interval **Obviously I wont be able to divide a time variable with a integer**

int counter = 0;
while (counter<numExec)
If system.time == StartTime+counter*Interval **again addition issue**
cout << "cool" <<endl;
counter++

** Also what if the code cant catch the time at right point. For example it is not at the logical check line (If system... ) at 9:15 and misses the cout.

Thanks for any help
closed account (3TXyhbRD)
Use code tags and indent the source code.
I don't have the actual code yet. Which will be TWAP and VWAP strategies and will be complex. I just want an idea of how to make the system time work. When I include time.h and say time(NULL) it tells me how many seconds it has been since 1970 which is sort of ... dum dum.

I can use the sleep function for my case too but I need to find a way to get the time "today"
when the function starts running.

Is there a function/method that returns 18000 when it is 5AM for example.(5*60*60)

thanks
closed account (3TXyhbRD)
In that case, check: http://www.cplusplus.com/reference/clibrary/ctime/localtime/
Topic archived. No new replies allowed.