1 2.. _timestamps: 3 4============================================================================== 5Timestamps 6============================================================================== 7 8.. _event_timestamps: 9 10------------------------------------------------------------------------------ 11Event timestamps 12------------------------------------------------------------------------------ 13 14Most libinput events provide a timestamp in millisecond and/or microsecond 15resolution. These timestamp usually increase monotonically, but libinput 16does not guarantee that this always the case. In other words, it is possible 17to receive an event with a timestamp earlier than the previous event. 18 19For example, if a touchpad has :ref:`tapping` enabled, a button event may have a 20lower timestamp than an event from a different device. Tapping requires the 21use of timeouts to detect multi-finger taps and/or :ref:`tapndrag`. 22 23Consider the following event sequences from a touchpad and a mouse: 24 25 26:: 27 28 Time Touchpad Mouse 29 --------------------------------- 30 t1 finger down 31 t2 finger up 32 t3 movement 33 t4 tap timeout 34 35 36For this event sequence, the first event to be sent to a caller is in 37response to the mouse movement: an event of type 38**LIBINPUT_EVENT_POINTER_MOTION** with the timestamp t3. 39Once the timeout expires at t4, libinput generates an event of 40**LIBINPUT_EVENT_POINTER_BUTTON** (press) with a timestamp t1 and an event 41**LIBINPUT_EVENT_POINTER_BUTTON** (release) with a timestamp t2. 42 43Thus, the caller gets events with timestamps in the order t3, t1, t2, 44despite t3 > t2 > t1. 45