Skip to content

d/survive: ajust timestamp from button event

Simon Zeni requested to merge bl4ckb0ne/monado:survive_button_time into main

The timecode of the pose event and the button event sent from libsurvive is slightly different, leading to wrong time values in the action timestamp.

Here's a sample debug output from my application, where I try to get a timespec from the XrActionStateBool field lastChangeTime

XR_ERROR_TIME_INVALID: xrConvertTimeToTimespecTimeKHR(time == -1639172960278117434) is not a valid time.
00:00:02.520 [openxr] failed to convert XrTime to timespec: XR_ERROR_TIME_INVALID

Trying to using the function survive_timecode_to_monotonic get the timestamp for the button event returns invalid data.

I opened an issue on libsurvive side, but the tl;dr of the issue is the following:

  • The button event takes its timecode from the function survive_run_time 2, which takes its time either from a user defined function, or from the time elapsed since the start time

  • The pose event takes its timecode from the current time.

I'm open to investigate other solution and fix the issue upstream (if it's really an issue), but in the meantime here's a patch

/cc @wallbraker

Merge request reports