Hello everybody,
I need an urgent help. I am using visual c++ 2003 and I am using a network simulator .In my program there is a function ----simulate(int no_events)---- that simulates the networ for the given number of events. I want to add a clock so as to be able to pre-define the simulation time...for example I want to simulate for 90 sec, 180 sec, 270 sec...and get te result for each simulation time. how could I do that?
The standard ctime routines (http://www.cplusplus.com/reference/clibrary/ctime/) deal with clocks - Just grab the time when you enter the function, then use a while loop with the test being (current_time > entry_Time + simulation_time) - it will ne be absolutely accurate as will only check the time once per loop, but may well be good enough for yuor needs.