The timestamp obtained by V4L2 has a stable bias when compared with the kernel's MONOTONIC time

I use V4L2 to get the image data timestamp. When I get a frame, I use clock_getTime (CLOCK_MONOTONIC, &TV) to get the system power-up time. The two times will have a stable offset (15-25s).

I think the reasons are:

The TS of V4L2 comes from VI, and the TS of VI is calculated by TSC, which is the count of SC7, and TSC has a fixed time difference with MONOTONIC of the system

View CMD: “cat /sys/devices/system/clocksource clocksource0 / offset_ns”, found that it is the offset

How can I fix this problem?

  1. Does the application layer automatically add this offset every time?

  2. Change the timestamp in VI?

hello 308959219,

you cannot “fix” this since they’re using different timestamps.
may I know what’s the actual use-case? please refer to SensorTimestampTsc.h File Reference, you’re able to use the interface to get TSC HW timestamp.
please see-also Topic 159220 for code snippets of the demonstration.
thanks