Calling clock_gettime behaves strangely with CLOCK_MONOTONIC CLOCK_MONOTONIC_RAW or CLOCK_MONOTONIC_BOOTTIME depending on which process you are in. Whithin usc and unity8 we get a consistent stream of monotonic time updates. independet of suspends/wakeups. Within a process like unity8-dash it seems to work until after the first suspend then the current time of CLOCK_REALTIME is returned.
This can be observed through input receiver traces in mir/unity8 and unity8-dash.
Then enable mirs input traces in /usr/share/upstart/sessions/unity8-dash.conf
i.e. add:
export MIR_CLIENT_INPUT_RECEIVER_REPORT=log
and for comparison you could do something similar in /usr/share/upstart/sessions/unity8.conf
You should get traces like:
[1447315263.459656] <DEBUG> input-receiver: Received event:touch_event(when=71864404480 (-88787157.149558 ms ago), from=0, touch = {{id=0, action=change, tool=finger, x=328.545, y=504.624, pressure=0.275735, major=7.98521, minor=0, size=0}, modifiers=1)
The timestamp at the beginning of the trace is gettimeofday(), but look at the "when=" part - this is the 'current time' androids input resampling believes it is.
Then after the wakeup you should see:
[1447315273.639723] <DEBUG> input-receiver: Received event:touch_event(when=1447404060779907704 (-88787140.-356826 ms ago), from=0, touch = {{id=0, action=down, tool=finger, x=416.229, y=593.339, pressure=0.291054, major=11.9778, minor=0, size=0}, modifiers=1)
Calling clock_gettime behaves strangely with CLOCK_MONOTONIC CLOCK_MONOTONIC_RAW or CLOCK_MONOTONIC _BOOTTIME depending on which process you are in. Whithin usc and unity8 we get a consistent stream of monotonic time updates. independet of suspends/wakeups. Within a process like unity8-dash it seems to work until after the first suspend then the current time of CLOCK_REALTIME is returned.
This can be observed through input receiver traces in mir/unity8 and unity8-dash.
Steps to reproduce - take the current released version of mir : bazaar. launchpad. net/~mir- team/mir/ 0.17/view/ head:/3rd_ party/android- input/android/ frameworks/ native/ libs/utils/ Timers. cpp y(&t, NULL); :nanoseconds( t.tv_sec) *1000000000LL + std::chrono: :nanoseconds( t.tv_usec) *1000LL;
http://
Modify
// we don't support the clocks here.
struct timeval t;
t.tv_sec = t.tv_usec = 0;
gettimeofda
return std::chrono:
into:
struct timespec t; gettime( CLOCK_MONOTONIC , &t); :nanoseconds( t.tv_sec* 1000000000LL) +
std::chrono: :nanoseconds( t.tv_nsec) ;
t.tv_sec = t.tv_nsec = 0;
clock_
return std::chrono:
Then enable mirs input traces in /usr/share/ upstart/ sessions/ unity8- dash.conf INPUT_RECEIVER_ REPORT= log
i.e. add:
export MIR_CLIENT_
and for comparison you could do something similar in /usr/share/ upstart/ sessions/ unity8. conf
You should get traces like: event(when= 71864404480 (-88787157.149558 ms ago), from=0, touch = {{id=0, action=change, tool=finger, x=328.545, y=504.624, pressure=0.275735, major=7.98521, minor=0, size=0}, modifiers=1)
[1447315263.459656] <DEBUG> input-receiver: Received event:touch_
The timestamp at the beginning of the trace is gettimeofday(), but look at the "when=" part - this is the 'current time' androids input resampling believes it is.
Then after the wakeup you should see: event(when= 144740406077990 7704 (-88787140.-356826 ms ago), from=0, touch = {{id=0, action=down, tool=finger, x=416.229, y=593.339, pressure=0.291054, major=11.9778, minor=0, size=0}, modifiers=1)
[1447315273.639723] <DEBUG> input-receiver: Received event:touch_
when= is now closer to gettimeofday..