I'm trying to synchronize an event inside Reaper with an event outside it.
The external event occurs at a known system time, given in
Epoch time with microsecond precision.
Lua provides
os.time() which is in Epoch time, but only has 1 second precision, which is not good enough for my usage.
Lua also provides
os.clock() which has millisecond precision, but it measures process runtime, not system time, so useless for this.
The Reaper API provides
reaper.time_precise() which has microsecond precision and
claims to be a "system timestamp", but it's not in Epoch time.
Here is example output of
time_precise() compared to
os.time():
time_precise: 709179.6048847; os.time(): 1685148400
time_precise: 709179.6335426; os.time(): 1685148400
time_precise: 709179.6653186; os.time(): 1685148400
time_precise: 709179.6973375; os.time(): 1685148400
time_precise: 709179.7284991; os.time(): 1685148400
time_precise: 709179.7615574; os.time(): 1685148400
time_precise: 709179.7903648; os.time(): 1685148400
time_precise: 709179.8204834; os.time(): 1685148400
time_precise: 709179.8554246; os.time(): 1685148400
time_precise: 709179.8863632; os.time(): 1685148400
time_precise: 709179.9166774; os.time(): 1685148400
time_precise: 709179.9473127; os.time(): 1685148400
time_precise: 709179.9811168; os.time(): 1685148401
time_precise: 709180.0095143; os.time(): 1685148401
time_precise: 709180.0403439; os.time(): 1685148401
time_precise: 709180.0703263; os.time(): 1685148401
time_precise: 709180.1036351; os.time(): 1685148401
time_precise: 709180.1335290; os.time(): 1685148401
time_precise: 709180.1683076; os.time(): 1685148401
time_precise: 709180.2003164; os.time(): 1685148401
time_precise: 709180.2352957; os.time(): 1685148401
time_precise: 709180.2643796; os.time(): 1685148401
time_precise: 709180.2960534; os.time(): 1685148401
os.time() is giving me the correct system time as Epoch time. WTF is that
time_precise() number? Is there some way to correlate it with system time? Does that correlation work cross platform?