Link to home
Start Free TrialLog in
Avatar of Tom211
Tom211

asked on

F*S*M T*ime

I want to implement an F*S*M  and when a "job" is at one state for some time ,for example 1 min and then go to other state.The problem is that i don't know how to implement the time(clock) of this  system.
Avatar of Infinity08
Infinity08
Flag of Belgium image

You want a delay of 1 minute ?

You can use the standard library for that, something like below (note that it's a busy wait, so likely not the preferred way to do it).

Or you can use platform dependent functionality, like sleep or usleep (Linux), Sleep (Windows), ...
What platform are you on ?
time_t tstart = time(0);
time_t tend = time(0);
while (difftime(tend, tstart) < 60.0f) {   // <--- one minute
  // busy wait
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial