From: Nicolas Dufresne <nicolas@ndufresne.ca>
To: Philippe De Muyter <phdm@macq.eu>, linux-media@vger.kernel.org
Subject: Re: UTC timestamps in v4l2 buffers
Date: Thu, 28 Jan 2021 15:14:03 -0500 [thread overview]
Message-ID: <e3c363b505cef5a7310ae293bccf6fac43fa71c2.camel@ndufresne.ca> (raw)
In-Reply-To: <20210108125334.GA30740@frolo.macqel>
Le vendredi 08 janvier 2021 à 13:53 +0100, Philippe De Muyter a écrit :
> Hello,
>
> I need to have the v4l2 buffers of my camera sensor timestamped with a
> precise (1ms) UTC timestamp, in order to be able to match images from cameras
> from several computers (that are of course synchronised with NTP, GPS or PTP).
>
> While I had that some years ago and still have in computers running
> freescale's 4.1.15 port for imx6q, I have now discovered that 8 years ago
> a decision has been taken by the v4l2 maintainers to switch the timestamp
> of the v4l2 buffers to CLOCK_MONOTONIC, which is useless when one needs
> to synchronise timestamps of images taken by cameras on different computers,
> which of course were not booted at the same time.
>
> At that time a new flag "V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC" was introduced
> to tell new users that the timestamp was no more the old and not standardized
> behaviour for timestamp, but the new CLOCK_MONOTONIC-based timestamp, but
> no other flag for UTC or way to choose which kind of timestamp one wants.
>
> Are there since then new standardized or work-in-progess flag to tell users
> that the timestamp is UTC, and way to ask the camera-acquisistion driver to
> give that UTC timestamp instead of the CLOCK_MONOTONIC one ?
Considering the CLOCK_MONOTONIC and CLOCK_REALTIME have the same slope (respond
to adjtime), you can probably just sample both clock in your application in
order to maintain a delta between both clocks. The more often your sample it,
the more precise you can derive. Don't forget to read REALTIME/MONOTONIC and
MONOTONIC/REALTIME orders, so you can averate to the real value. (GStreamer
needs to be improved in this regard).
>
> Best regards.
>
> Philippe
>
next prev parent reply other threads:[~2021-01-28 20:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-08 12:53 UTC timestamps in v4l2 buffers Philippe De Muyter
2021-01-28 20:14 ` Nicolas Dufresne [this message]
2021-01-28 22:00 ` Philippe De Muyter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e3c363b505cef5a7310ae293bccf6fac43fa71c2.camel@ndufresne.ca \
--to=nicolas@ndufresne.ca \
--cc=linux-media@vger.kernel.org \
--cc=phdm@macq.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox