How to get date and time from EGLStream::IFrame

I would like to get the date and time of a frame grabbed by the camera using Argus library.

I use EGLStream::IFrame::getTime() method.

The method should returns the time in nano seconds but I have seen in your file EventThread.cpp following comment:

                /// @todo IEvent documentation says the time value is in nano seconds, but
                ///       actually it's in micro seconds.
                const TimeValue latency =
                    TimeValue::fromUSec(iEvent->getTime()) ...

So, I tried both (nanoseconds and micro seconds) and I can’t get right time from any of one.

Here is a piece of code and the output generated (I use Poco c++ for date manipulation). And to compare with linux time I complete the test with gettimeofday call :

timeStamp_us = iFrame->getTime();
LOG_NOTICE_F("timeStamp_us = %ld", timeStamp_us);
LOG_NOTICE_F("timeStamp = %s", Poco::DateTimeFormatter::format(Poco::Timestamp(frame->meta().timeStamp_us), "%Y-%m-%dT%H:%M:%S.%iZ"));

struct timeval val;
gettimeofday(&val, NULL);
long int total = val.tv_sec * 1'000'000 + val.tv_usec;
LOG_NOTICE_F("timeval : %ld, %ld, total : %ld : %s", val.tv_usec, val.tv_sec, total, Poco::DateTimeFormatter::format(Poco::Timestamp(total), "%Y-%m-%dT%H:%M:%S.%iZ"))

Here is the output:

timeStamp_us = 15799841851000
timeStamp = 1970-07-02T20:50:41.851Z
timeval : 735292, 1608060963, total : 1608060963735292 : 2020-12-15T19:36:03.735Z

My linux card is not up to date and is still configured to the 2020/12/15 but not matters.

The provided timestamp by nvidia interface is 14 digits (15’799’841’851’000).
The unix timestamp by the system is 10 digits (1’608’035’111).

I don’t understand how to get unix timestamp with getTime() function.

Hi,
Timestamp information is in metadata. Please refer to the sample:

/usr/src/jetson_multimedia_api/argus/samples/yuvJpeg

It has demo code of getting metadata of captured frames.

It is where I took my example and I havn’t managed to get valid values.

In my console I ran:

$ date
Tue Dec 15 15:55:41 UTC 2020

and in my software I just did:

LOG_NOTICE_F("getTime : %?u", iFrame->getTime());

and I got output:

[Notice] : getTime : 2576699895000

I can’t manage to convert this value to a correct timestamp value even multiplying or dividing by 10, 100 or 1000.

The timestamp from the argus is the kernel time.
Have a reference to below topic for more information.