How to convert timestamp in human readable form.

Matteo Valdina matteo.valdina at gmail.com
Sat Jul 7 12:29:06 UTC 2018


Hi,
Give a look to the GST_TIME_FORMAT.

https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-TIME-FORMAT:CAPS

This is a simple way to print a GstClockTime to something readable.

Best
Matteo

On Sat, Jul 7, 2018, 04:32 Antonio Ospite <ao2 at ao2.it> wrote:

> 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?
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20180707/1ca4962a/attachment.html>


More information about the gstreamer-devel mailing list