Argus::ICaptureMetadata::getSensorTimestamp clock domain in L4T 32.4.4

Hello,
When looking at Argus API, the function to get the camera capture timestamp is:

Argus::ICaptureMetadata::getSensorTimestamp

The help says:
Returns the start timestamp for the sensor (in nanoseconds).
This is the time that the first data from this capture arrives from the sensor.

But we don’t know the clock domain.
Is this CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW or another?
We use L4T 32.4.4.

thank you

1 Like

Have reference to below topic.

Hello,
I have read this topic and you say that Argus::ICaptureMetadata::getSensorTimestamp give the kernel timestamp.
What is the clock domain for kernel timestamp: is it Wall Clock or MONOTONIC_CLOCK or another? the topic given doesn’t say it.
I need to compare this timestamp to another timestamp based on MONOTONIC_CLOCK. How can i do it?
thank you

Looks like it’s MONOTONIC_RAW

Hello,
excuse me but “looks like it’s MONOTONIC_RAW” seems a little imprecise.
I need to be certain that it is “MONOTONIC_RAW” or not. And if not then which clock it is.
thanks

hello Denisss,

since you’re now working with l4r-r32.4.4. please note that there’ll be timestamp modification for next public release.
please refer to the statement in Topic 78821, recap as below…

we had some changes for Xavier to plumbed up the hardware timestamps into camera software stack.
there’ll be start-of-frame and end-of-frame sensor timestamps include in metadata from TSC hardware, by using new interfaces for TSC HW timestamp; you may expect those changes will be include to next public release, i.e. JetPack-4.5 / l4t-r32.5.


iCaptureMetadata->getSensorTimestamp() return the kernel timestamp (i.e. MONOTONIC_RAW) of sensor start-of-frame.
as you can see, there’s formula to calculate the HW capture timestamp (TSC) from system time.

clock_gettime(MONOTONIC_RAW) = cycle_ns(TSC) - offset_ns

please refer to below example for offset_ns to compensate the capture timestamp.
for example,

root@tegra-ubuntu:~# cat /sys/devices/system/clocksource/clocksource0/offset_ns
9045955168
diff --git a/drivers/media/platform/tegra/camera/vi/vi5_fops.c b/drivers/media/platform/tegra/camera/vi/vi5_fops.c
index f8c0df5..6a7c370 100644
--- a/drivers/media/platform/tegra/camera/vi/vi5_fops.c
+++ b/drivers/media/platform/tegra/camera/vi/vi5_fops.c
@@ -427,6 +427,9 @@ static void vi5_capture_dequeue(struct tegra_channel *chan,
    /* Read SOF from capture descriptor */
    ts = ns_to_timespec((s64)descr->status.sof_timestamp);
... 
+   pr_err("Jerry %s timestamp= %ld.%ld Line(%d)\n", __func__, ts.tv_sec, ts.tv_nsec, __LINE__);
kernel log
[  128.924693] Jerry vi5_capture_dequeue timestamp= 137.483546848 

which means… 128.924693 + 9045955168(ns) ~= 137.483546848


VI drivers to capture frame and store the timestamp with TSC.
you may also adding some kernel APIs for checking timestamp difference within the VI drivers.
for example,

*ts = ns_to_timespec((s64)status.sof_ts);
+ printk("VI: RTCPU SOF timestamp %lu.%lu s\n", ts->tv_sec, ts->tv_nsec);
+ sys_clock_gettime(CLOCK_MONOTONIC, &monotonic);
+ printk("VI: Monotonic Raw timestamp %lu.%lu s\n", monotonic.tv_sec, monotonic.tv_nsec);
1 Like
Libargus give different timestamps after setting up timesync
Lidar + Camera synchronization (Argus returns monotonic_clock time, lidars system clock time)
Nvarguscamera timestamp location
Jetson TX2 camera latency analysis (how to get timestamp of target frame in each processing stage)
Tx2 jetson_multimedia_api got capture timestamp?
Get frame system time
Jetson agx orin: Clarification on SOF/EOF Timestamps in Tegra Camera Module Debug Logs
Argus timestamps issue
Glass to glass latency 4k@60fps on Orin AGX
What is the relationship between RCE timestamp and TSC timestamp?
How to obtain accurate UTC0 frame timestamps
Wrong timestamp from libargus EGLStream::MetadataContainer
GTE Timestamp conversion to CLOCK_REALTIME
V4l2_buffer timestamp starts at 0, not MONOTONIC_RAW
How to test image transmission delay?
Camera timestamp
What is jetson agx orin [RCE sof eof] time accuracy
How to Retrieve Accurate Timestamps from Buffers Without Inference Metadata in GStreamer HEVC Branch
Sensor time
JetPack 4.4 Start of frame Timestamp to monotonic raw
Argus::ICaptureMetadata::getSensorTimestamp clock conversion to datetime
How to get crurent tsc
Timestamps on JetPack 4.6
Could you give details on time embedded in the frames (iFrame->getTime()) when using nvarguscamerasrc plugin?
GPS time synch
Need help getting timestamp from IMX390 camera using nvarguscamerasrc
Take timestamp when frame come in
R35.3.1 jetson orin v4l2 kernel vb->timestamp How to obtain
Accurate Frame Timestamping Gstreamer & OpenCV
Image with timestamp embedded to it
Need help getting timestamp from IMX390 camera using nvarguscamerasrc
Where is the image frame timestamp set in the VI module driver?
Nvarguscamerasrc timestamping
V4L frame timing on Orin/Jetpack5
Can RCE timestamps be synchronized?
Enable v4l2 timestamps for each frames captured
GStreamer command for multi-camera capture with a common clock synchronization

hi all,

for the r32.5 release
you are able to fetch start-of-frame and end-of-frame timing via TSC HW timestamp.

it returns the VI HW (SoF/EoF) timestamp based-on tegra wide timestamp system counter (TSC), it’s the timestamp for the sensor (unit in nanoseconds).
here’s code snippet by modify Argus sample code (i.e. userAutoExposure) to use the interface to get TSC HW timestamp.
for example,

+++ b/public/samples/userAutoExposure/main.cpp
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <Argus/Argus.h>
 #include <Argus/Ext/BayerAverageMap.h>
+#include <Argus/Ext/SensorTimestampTsc.h>
 #include <EGLStream/EGLStream.h>
 #include "PreviewConsumer.h"
 #include "CommonOptions.h"
@@ -298,6 +299,14 @@ static bool execute(const UserAutoExposureSampleOptions& options)
                 uint64_t frameExposureTime = iMetadata->getSensorExposureTime();
                 float frameGain = iMetadata->getSensorAnalogGain();

+                const Ext::ISensorTimestampTsc *iSensorTimestampTsc = interface_cast<const Ext::ISensorTimestampTsc>(metaData);
+                if (iSensorTimestampTsc)
+                {
+                        printf("sof= %lu, eof= %lu\n",
+                               iSensorTimestampTsc->getSensorSofTimestampTsc(),
+                               iSensorTimestampTsc->getSensorEofTimestampTsc());
+                }