Debian Codegraph @

doc/user/timestamps.rst

raw
1
2 .. _timestamps:
3
4 ==============================================================================
5 Timestamps
6 ==============================================================================
7
8 .. _event_timestamps:
9
10 ------------------------------------------------------------------------------
11 Event timestamps
12 ------------------------------------------------------------------------------
13
14 Most libinput events provide a timestamp in millisecond and/or microsecond
15 resolution. These timestamp usually increase monotonically, but libinput
16 does not guarantee that this always the case. In other words, it is possible
17 to receive an event with a timestamp earlier than the previous event.
18
19 For example, if a touchpad has :ref:`tapping` enabled, a button event may have a
20 lower timestamp than an event from a different device. Tapping requires the
21 use of timeouts to detect multi-finger taps and/or :ref:`tapndrag`.
22
23 Consider 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
36 For this event sequence, the first event to be sent to a caller is in
37 response to the mouse movement: an event of type
38 **LIBINPUT_EVENT_POINTER_MOTION** with the timestamp t3.
39 Once 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
43 Thus, the caller gets events with timestamps in the order t3, t1, t2,
44 despite t3 > t2 > t1.
45
46 libinput timestamps use **CLOCK_MONOTONIC**.