mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-17 20:00:35 +02:00
The loop reads its clock at the top and ft-hands' files later in the pass.
A frame written in between has publish_ns after tnow, and the unsigned
"now - publish_ns" in HandsInRoom::Live wrapped round: the feed read as
stale for that one pass, both sides went "off", and the "hands" word to
ft-screens flickered to "off off" and back. 2026-10-10 20:30-20:37: 24
flickers in 7 minutes, each with ft-hands publishing at full rate (pinches
logged at the same moments), each ending ft-screens' holds and the ray.
feedage.h: AgeNs/Fresh, age 0 for a frame from after "now". Live and the
gestures check that ends holds ("hand tracking stopped") use them.
pointer/tests/feedage-test.cpp replays the loop against 30, 15 and 1 Hz
publishing: the old check calls 28-2408 passes stale, the new one none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
1.2 KiB
C++
25 lines
1.2 KiB
C++
// How old a file ft-hands published is (fh_hands.h, fh_gestures.h: publish_ns, CLOCK_MONOTONIC),
|
|
// seen from the pointer helper's loop. Header-only and free of OpenVR, so pointer/tests/feedage-test.cpp
|
|
// can drive it.
|
|
//
|
|
// The loop reads its clock once, at the top (tnow), and the files later in the same pass. A frame
|
|
// ft-hands writes in between carries a publish_ns after tnow. Unsigned "now - publish" then wraps to
|
|
// about 584 years: the feed read as stale for that one pass, so the handoff's sides went "off" and
|
|
// the "hands" word to ft-screens flickered to "off off" and back (24 times in 7 minutes on
|
|
// 2026-10-10, each ending whatever ft-screens held, and the ray). A frame from after "now" is age 0.
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
namespace hin {
|
|
|
|
// publishNs's age at nowNs, in ns; 0 when it was published at or after nowNs.
|
|
inline uint64_t AgeNs(uint64_t nowNs, uint64_t publishNs) { return nowNs > publishNs ? nowNs - publishNs : 0; }
|
|
|
|
// Something was published (publishNs set) less than maxAgeNs before nowNs, or after it.
|
|
inline bool Fresh(uint64_t nowNs, uint64_t publishNs, uint64_t maxAgeNs) {
|
|
return publishNs != 0 && AgeNs(nowNs, publishNs) < maxAgeNs;
|
|
}
|
|
|
|
} // namespace hin
|