op_ev_time()
Abstract
Obtains the time at which the specified event is scheduled to occur.
Syntax
op_ev_time (evhandle)
| Argument | Type | Description |
|---|---|---|
evhandle |
Evhandle |
event handle that identifies the event [An event handle can be obtained from several KPs in this package—such as op_ev_current(), op_ev_seek_time(), and op_ev_next()—and others such as op_intrpt_schedule_self().]. |
Return Type
double
The simulation time at which the specified event is scheduled to occur.
This double-precision floating-point number represents simulation time, in seconds, measured from the beginning of the simulation. The value OPC_TIME_INVALID will be returned if a recoverable error occurs.
Example
/* Determine if any interrupts on the Q_LEN statwire are scheduled */
/* to occur in the next five seconds. */
stat_intrpt_found = 0;
time_boundary = op_sim_time () + 5.0;
event = op_ev_next (op_ev_current ());
while (op_ev_valid (event))
{
/* If the event is after the time boundary, then quit looking. */
if (op_ev_time (event) > time_boundary)
break;
/* If it is a statwire intrpt on the Q_LEN statwire, note it and break out. */
if ((op_ev_type (event) == OPC_INTRPT_STAT) &&
(op_ev_stat (event) == Q_LEN_STATWIRE))
{
stat_intrpt_found = 1;
break;
}
/* Didn’t match, so try the next local event. */
event = op_ev_next_local (event);
}
Details
The returned value is a double-precision, floating-point number that indicates the time value associated with the specified event. Note that op_ev_time (op_ev_current ()) is equivalent to op_sim_time().
Note: If the “sim_time_quantum“ preference has a value other than 0.0, the simulation time returned will be a multiple of the specified quantum.
Purpose
Provides a mechanism to determine the time at which an event is scheduled to occur.
Errors
- Program Abort: Segmentation violation. (due to a malformed event handle)
- Recoverable Error: Event handle refers to an event that is either invalid or not currently scheduled.
Reference
- Use the KP op_ev_valid() to determine if the Evhandle is valid
- Use the KP op_ev_type() to determine the type of the event
- Use the KP op_ev_code() to determine the code of a self, remote, or multicast interrupt
- Use the KP op_ev_strm() to determine the stream index associated with a stream interrupt
- Use the KP op_ev_stat() to determine the input statistic index associated with a statistic interrupt