clock: Fix _STIME_FORMAT macros

This macro didn't work well as it relied on the sign on the last
divided number (number of days). This value is most of the time
zero, and zero is considered positive in printf. Instead, deal with
the sign manually, and resuse the original macros for the rest. This
actually simplify the macro a lot.
This commit is contained in:
Nicolas Dufresne 2015-06-15 10:06:00 -04:00
parent 7be8acbfb0
commit 5bdd92be75

View file

@ -253,7 +253,7 @@ G_STMT_START { \
*
* Since: 1.6
*/
#define GST_STIME_FORMAT "d:%02u:%02u.%09u"
#define GST_STIME_FORMAT "c%" GST_TIME_FORMAT
/**
* GST_STIME_ARGS:
* @t: a #GstClockTimeDiff or #gint64
@ -264,14 +264,7 @@ G_STMT_START { \
* Since: 1.6
*/
#define GST_STIME_ARGS(t) \
GST_CLOCK_STIME_IS_VALID (t) ? \
(gint) ((GstClockTimeDiff)(t) / (GST_SECOND * 60 * 60)) : -99, \
GST_CLOCK_STIME_IS_VALID (t) ? \
(guint) ((((GstClockTime)ABS(t)) / (GST_SECOND * 60)) % 60) : 99, \
GST_CLOCK_STIME_IS_VALID (t) ? \
(guint) ((((GstClockTime)ABS(t)) / GST_SECOND) % 60) : 99, \
GST_CLOCK_STIME_IS_VALID (t) ? \
(guint) (((GstClockTime)ABS(t)) % GST_SECOND) : 999999999
((t) >= 0) ? ' ' : '-', GST_TIME_ARGS (ABS (t))
typedef struct _GstClockEntry GstClockEntry;
typedef struct _GstClock GstClock;