The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

aux: Use time since time_state creation for time_state timestamps

Easy to read timestamps and somewhat meaningful.

authored by

Christoph Haag and committed by
Jakob Bornecrantz
803e9531 2e2a62ce

+6 -4
+6 -4
src/xrt/auxiliary/util/u_time.cpp
··· 28 28 29 29 struct time_state 30 30 { 31 - // Hardcoded to one second offset. 32 - timepoint_ns offset = 1000 * 1000 * 1000; 31 + timepoint_ns offset; 33 32 }; 34 33 35 34 ··· 43 42 time_state_create() 44 43 { 45 44 time_state *state = new (std::nothrow) time_state; 45 + state->offset = os_monotonic_get_ns(); 46 46 return state; 47 47 } 48 48 ··· 109 109 { 110 110 assert(state != NULL); 111 111 112 - return monotonic_ns + state->offset; 112 + return monotonic_ns - state->offset; 113 113 } 114 114 115 115 extern "C" uint64_t 116 116 time_state_ts_to_monotonic_ns(struct time_state const *state, 117 117 timepoint_ns timestamp) 118 118 { 119 - return timestamp - state->offset; 119 + assert(state != NULL); 120 + 121 + return timestamp + state->offset; 120 122 }