Jump to content

Access to system timestamps


Recommended Posts

Hi, 
I was looking into timestamps generated by SRAnipal as well as Tobii SDK. In case of SRANipal, the timestamps correspond to local time stamp of eye tracker. In case of Tobii, the sdk provides two time stamps: local time stamp (as timestamp_tracker_us) which is similar to what we get in sranipal and an additional one, system (timestamp_system_us) which is synced with computer time. Is there a way to get the system time stamps in sranipal sdk via some sort of patch, etc?

Regards,
Nitesh

@Daniel_Y @Corvus

Link to comment
Share on other sites

  • 1 month later...
  • 11 months later...

Hi @VGagliano

Yes it was~.

Please flow the sample code to get system timestamps.

int result = ViveSR::anipal::Eye::SRanipal_UpdateTimeSync();

if( result  == ViveSR::Error::WORK  ){

    int64_t time;

    ViveSR::anipal::Eye::SRanipal_GetSystemTime(&time);

    printf("%u",(unsigned )time);

}

  • Thanks 1
Link to comment
Share on other sites

  • 4 weeks later...
On 7/15/2021 at 12:06 PM, Hank_Li said:

Hi @VGagliano

Yes it was~.

Please flow the sample code to get system timestamps.

int result = ViveSR::anipal::Eye::SRanipal_UpdateTimeSync();

if( result  == ViveSR::Error::WORK  ){

    int64_t time;

    ViveSR::anipal::Eye::SRanipal_GetSystemTime(&time);

    printf("%u",(unsigned )time);

}

Dear Hank_Li, 

I have troubles running this piece of code - is there documentation on this method? So far I haven't find the description. Thank you!

Link to comment
Share on other sites

  • 9 months later...
  • 2 weeks later...

I assume that SRanipal_Eye_API.SRanipal_GetSystemTime(ref long timestamp) gives you the you the tick count since system start.

To get it along the EyeData.timeStamp you could use this:

int SRanipalSystemToEyeTrackerTimeStamp(long timeStamp)
                {
                    // Value is generated by observation
                    long maxEyeDataTimestampValue = uint.MaxValue;
                    timeStamp %= maxEyeDataTimestampValue;
                    // Magic trick to round the integer at the fourth last digit
                    timeStamp += 500;
                    // Cutting of the last three digits
                    timeStamp /= 1000;
                    return (int) timeStamp;
                }

Link to comment
Share on other sites

On 6/3/2022 at 12:09 PM, paulm said:

I assume that SRanipal_Eye_API.SRanipal_GetSystemTime(ref long timestamp) gives you the you the tick count since system start.

To get it along the EyeData.timeStamp you could use this:

int SRanipalSystemToEyeTrackerTimeStamp(long timeStamp)
                {
                    // Value is generated by observation
                    long maxEyeDataTimestampValue = uint.MaxValue;
                    timeStamp %= maxEyeDataTimestampValue;
                    // Magic trick to round the integer at the fourth last digit
                    timeStamp += 500;
                    // Cutting of the last three digits
                    timeStamp /= 1000;
                    return (int) timeStamp;
                }

Hi @paulm,

Can you please share a sample code of how you achieved to collect eye data using this? I am also having trouble collecting eye data with the system timestamps. Looking forward to hearing from you! 🙂 Thanks.

Link to comment
Share on other sites

Actually for collecting the eye data I do still use an almost unaltered eye data callback function like described in https://forum.vive.com/topic/9341-vive-eye-tracking-at-120hz/ . I do still use the timestamp which comes with it as I suppose that it is an altered system timestamp.

Using Windows & Unity:

                private void Update()
                {  

                  long timestamp = 0;

                  SRanipal_Eye_API.SRanipal_GetSystemTime(ref long timestamp)

                  Vector3 headPose = Camera.main.transform.rotation.eulerAngles;

                  timestamp = SRanipalSystemToEyeTrackerTimeStamp(long timeStamp)

                }

I am proposing that the timestamp above can now be compared with eyeData.timestamp which you get through the eye data callback function for synchronizing purposes. Cheers. 😃

 

Edited by paulm
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...