Timestamp CURRENT and IMAGE

I need to build a real-time system. However, I noticed that when I call grab(), I first record the current time (CURRENT_TIME), then obtain the image via grab(), and check the image’s timestamp (IMAGE_TIME). I found that IMAGE_TIME is earlier than CURRENT_TIME, which indicates the image was captured earlier than the moment I called grab(). How can I resolve this? What I need is an image exposed by the camera at the exact moment I invoke grab().
code:
_writeframe->timestamp = std::chrono::duration_caststd::chrono::milliseconds(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
_zedx.retrieveImage(img, VIEW::LEFT);
_zedx.grab(_runtime_parameters)
frame->zedtimestamp = img.timestamp.getMilliseconds();
_writeframe->timestamp is 1742878091686 ms
frame->zedtimestamp is 1742878091668 ms

IMAGE TIME < CURRENTIME

Hi @Fxy
Welcome to the Stereolabs community.

This is correct, and it’s the expected behavior. The image timestamp is assigned when the data is available in the memory buffer.

CURRENT_TIME is the current OS time, at the moment that you retrieve it.