On Thu, Aug 31, 2017 at 6:17 AM, yihungbakj hung <
yihun...@gmail.com> wrote:
> Hi Niels
>
> How to convert video frame timestamps to unix timestamps?
The easy case is if the frames also carry a valid ntp timestamp, ntp
time differs from unix time by a constant number of seconds.
To convert between monotonic time (rtc::TimeMicros, or
clock_gettime(CLOCK_MONOTONIC), and unix wall clock time like
gettimeofday, you would have to call both functions and compute the
offset.
At least on linux, they will run at the same frequency, controlled by
the ntp daemon, so the offset will be constant unless the system time
is changed by settimeofday. But in general, there may be some drift
between the two clocks.
I imagine that internally in the kernel, there's some offset used to
translate between monotonic time and gettimeofday; if you find any way
to access that offset, I'd like to know.
So it's a bit tricky. Don't do the conversion if there's any way you
can avoid it.
Regards,
/Niels