NOW

The NOW function returns the current time in milliseconds. This can be used to implement timeouts, timing of signals, etc.

The time returned is actually the number of milliseconds since 12am on January 1, 1601 UTC. However, when formatting a date or time, it is automatically converted into local time.

Previous versions of XJTAG allowed NOW to be called without any brackets. Support for this usage was removed in XJTAG v4.0.

Syntax

NOW()

Return value

An INT value containing a timestamp in milliseconds.

Example

// Function to wait for a statusBit to go low with a one second timeout.
//
// Returns signal = 1 on timeout
//
LOCAL WaitForSignal()(INT signal)

  // Timeout is in one second's time.
  INT end := NOW() + 1000;
  INT value;

  DO
    SET value := statusBit;
  WHILE value != 0 &&? NOW() < end
  END;

  signal := value;
END;