CAPL Script

TimeNow

This reference collection includes Vector documentation reproduced with permission. Snippets may require configuration-specific symbols and are not all standalone programs. Sources and validation limits.

Syntax and units

dword timeNow();

Returns current simulation time in units of 10 microseconds. Divide by 100 for milliseconds or 100,000 for seconds. The 32-bit representation covers roughly 11.93 hours before the range boundary, so do not use it as an unlimited-duration absolute clock. The available reference notes that effective resolution depends on the hardware.

Example: inspect current execution time

on key 't'
{
  dword ticks;
  float seconds;
  ticks = timeNow();
  seconds = ticks / 100000.0;
  write("Current simulation time: %.5f s", seconds);
}

The floating-point divisor preserves the fractional seconds. This reports the time when the handler reads the clock. It does not retrieve the timestamp of an earlier received frame and is not a wall-clock date.

For message period measurements, use the timestamp carried by each event and retain a consistent stream and unit. The timestamp walkthrough shows TIME_NS and explains the legacy TIME conversion. For long recordings check the higher-range APIs supported by your installed version, rather than subtracting wrapped unsigned times and calling the result a real gap.

Source and validation

API signatures and behavior follow the authorized Vector reference. The explanations and inspection examples are site guidance, not recorded CANoe test results. Check the installed help for your tool version and node type. See sources and validation limits.