Skip to content

Request for help in using UNIX time in Natnet SampleClient.cpp #3

@gauricollab09

Description

@gauricollab09

My question is regarding Optitrack - Motive and NatNet SDK SampleClient.cpp script.

My goal is to capture the "time now" in UNIX on my NatNet machine, which is running on Ubuntu.

However, I’m having trouble figuring out where exactly to implement this in the SampleClient.cpp code. I’ve already added the following line using std::chrono to capture the current time in the Data handler:

const auto now = std::chrono::system_clock::now();
const std::time_t t_c = std::chrono::system_clock::to_time_t(now);

image (1)

But I’m unsure if this should be placed inside the void NATNET_CALLCONV DataHandler(sFrameOfMocapData* data, void* pUserData) function or elsewhere. I also want to use the time_now in the OutputFrameQueueToConsole() function where the latencies, etc are printed, but I’m a bit confused on how to approach this since I’m not very comfortable with C++ code. (Running into errors accessing the variables etc)

printf("Server Timestamp : %s\n", std::ctime(&t_c));
image (2)

Could you provide some guidance on where this logic should go? Thank you so much for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions