Microsoft DirectX 9.0

Time Stamps and Sequence Numbers

When Microsoft?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. It also contains 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 Microsoft Win32GetTickCount 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 buffered event from any device. (Simultaneous events on the same device, such as diagonal mouse movements, increment the count only once.) Use this number to compare events from different devices and see which came first. The DISEQUENCE_COMPARE macro, used for comparing DirectInput sequence numbers, takes wraparound into account.

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

© 2002 Microsoft Corporation. All rights reserved.