How to convert timestamp in human readable form.

Antonio Ospite ao2 at ao2.it
Sat Jul 7 09:02:45 UTC 2018


On Sat, 7 Jul 2018 11:50:57 +0530
Shubham Shrivastava <shubham333vm at gmail.com> wrote:

> timestamp: 178452710056
[...]
> 
> this type of output i got from
> 
>       gst_structure_get_clock_time (s,"timestamp",&timestamp);
[...]
>    strptime("178452710056", "%s", &tm);

Two issues here:

1. the returned timestamp is relative to the structure field lifetime,
   it does not refer to the system time.
2. GstClockTime expresses time in nanoseconds, not seconds.

Try using
https://developer.gnome.org/glib/stable/glib-Date-and-Time-Functions.html#g-get-real-time
and take care to convert units (g_get_real_time returns microseconds).

Ciao,
   Antonio

-- 
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


More information about the gstreamer-devel mailing list