Platform SDK: DirectX

Time Stamps and Sequence Numbers

[C++]

When DirectInput input data is buffered (see Buffered and Immediate Data), each DIDEVICEOBJECTDATA structure contains not only information about the type of event and the device object associated with it, but also a time stamp and a sequence number.

The dwTimeStamp member contains the system time, in milliseconds, at which the event took place. This is equivalent to the value that would have been returned by the Win32 GetTickCount function, but at a higher resolution.

The dwSequence member contains a sequence number assigned by DirectInput. The DirectInput system keeps a single sequence counter, which is incremented by each nonsimultaneous buffered event from any device. Use this number to compare events from different devices and see which came first. The DISEQUENCE_COMPARE macro takes wrap around into account.

[Visual Basic]

When DirectInput input data is buffered (see Buffered and Immediate Data), each DIDEVICEOBJECTDATA type contains not only information about the type of event and the device object associated with it, but also a time stamp and a sequence number.

The lTimeStamp member contains the system time, in milliseconds, at which the event took place. This is equivalent to the value that would have been returned by the Win32 GetTickCount function, but at a higher resolution.

The lSequence member contains a sequence number assigned by DirectInput. The DirectInput system keeps a single sequence counter, which is incremented by each nonsimultaneous buffered event from any device. Use this number to compare events from different devices and see which came first.

Simultaneous events are assigned the same sequence number. If a mouse or joystick is moved diagonally, for example, the changes in the x-axis and the y-axis have the same sequence number.

Note  Events are always placed in the buffer in chronological order, so you do not need to check the sequence numbers to sort the events from a single device.