Home › Forums › Software Development › C++ Interaction Library – What’s IL::Timestamp counted in?
Tagged: c++, interaction, timestamp
- This topic has 1 reply, 2 voices, and was last updated 3 years, 7 months ago by Grant [Tobii].
- AuthorPosts
- 08/03/2021 at 16:36 #20015HarrisonParticipant
Hello,
As the title says, I want to know what IL::Timestamp is counting in?
I believe it’s based in microseconds (us) which is 1 second = 1000000 usUsing some modified sample code:
intlib->SubscribeGazeFocusEvents([](IL::GazeFocusEvent evt, void* context) { std::list<GazeEvent>& gazeVec = *static_cast<std::list<GazeEvent>*>(context); GazeEvent gaze = GazeEvent(evt.id, evt.timestamp_us, evt.hasFocus); gazeVec.push_back(gaze); }, &gazeVec);
Printing out evt.timestamp_us I have this value: 25769125018
Dividing that by 1000000 only gets: 25769.1
And I definitely wasn’t running the code for 25769.1 seconds before the time was registered.So going back to my original question, what actually is IL::Timestamp?
09/03/2021 at 18:13 #20024Grant [Tobii]KeymasterHi @itsmehjb, The IL::Timestamp is merely a number for an instant in time. It’s based from the processor clock and is counted in micro-seconds.
It’s mainly to be used for relative purposes, eg this timestamp minus the last one. If required wants, one can simply save the first timestamp receivee and subtract that from all future timestamps to get “time since started”.
One could also query the high-performance counter directly at the start of the program and use that as the zeroing-value, as long as it is converted to microseconds.
- AuthorPosts
- You must be logged in to reply to this topic.