qa-report: use gst_util_get_timestamp for report times
authorThiago Santos <thiago.sousa.santos@collabora.com>
Mon, 15 Jul 2013 13:15:06 +0000 (10:15 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Mon, 15 Jul 2013 13:15:06 +0000 (10:15 -0300)
Makes it more aligned with GST_DEBUG output

validate/gst/qa/gst-qa-report.c
validate/gst/qa/gst-qa-report.h
validate/gst/qa/gst-qa-runner.c

index faa31b3..dd554c4 100644 (file)
 
 #include "gst-qa-report.h"
 
+static GstClockTime _gst_qa_report_start_time = 0;
+
+void
+gst_qa_report_init (void)
+{
+  if (_gst_qa_report_start_time == 0)
+    _gst_qa_report_start_time = gst_util_get_timestamp ();
+}
+
 const gchar *
 gst_qa_error_area_get_name (GstQaErrorArea area)
 {
@@ -51,7 +60,7 @@ gst_qa_error_report_new (GstObject * source, GstQaErrorArea area,
   report->area = area;
   report->message = g_strdup (message);
   report->detail = g_strdup (detail);
-  report->timestamp = g_date_time_new_now_local ();
+  report->timestamp = gst_util_get_timestamp () - _gst_qa_report_start_time;
 
   return report;
 }
@@ -62,13 +71,12 @@ gst_qa_error_report_free (GstQaErrorReport * report)
   g_free (report->message);
   g_free (report->detail);
   g_object_unref (report->source);
-  g_date_time_unref (report->timestamp);
   g_slice_free (GstQaErrorReport, report);
 }
 
 void
 gst_qa_error_report_printf (GstQaErrorReport * report)
 {
-  g_print (GST_QA_ERROR_REPORT_PRINT_FORMAT "\n",
+  g_print ("%" GST_QA_ERROR_REPORT_PRINT_FORMAT "\n",
       GST_QA_REPORT_PRINT_ARGS (report));
 }
index b6993bf..0be4eb1 100644 (file)
@@ -38,23 +38,18 @@ typedef struct {
   GstQaErrorArea area;
   gchar *message;
   gchar *detail;
-  GDateTime *timestamp;
 
   GstObject *source;
+  guint64 timestamp;
 } GstQaErrorReport;
 
-#define GST_QA_ERROR_REPORT_PRINT_FORMAT "%04d-%02d-%02dT%02d:%02d:%02d.%06d: %s, %s(%d)) %s (%s)"
-#define GST_QA_REPORT_PRINT_ARGS(r) g_date_time_get_year (r->timestamp), \
-                                    g_date_time_get_month (r->timestamp), \
-                                    g_date_time_get_day_of_month (r->timestamp), \
-                                    g_date_time_get_hour (r->timestamp), \
-                                    g_date_time_get_minute (r->timestamp), \
-                                    g_date_time_get_second (r->timestamp), \
-                                    g_date_time_get_microsecond (r->timestamp), \
+#define GST_QA_ERROR_REPORT_PRINT_FORMAT GST_TIME_FORMAT ": %s, %s(%d)) %s (%s)"
+#define GST_QA_REPORT_PRINT_ARGS(r) GST_TIME_ARGS (r->timestamp), \
                                     r->source ? GST_OBJECT_NAME(r->source) : "null", \
                                     gst_qa_error_area_get_name(r->area), r->area, \
                                     r->message, r->detail
 
+void               gst_qa_report_init (void);
 GstQaErrorReport * gst_qa_error_report_new (GstObject * source, GstQaErrorArea area, const gchar * message, const gchar * detail);
 void               gst_qa_error_report_free (GstQaErrorReport * report);
 
index 79390ba..9312be4 100644 (file)
@@ -61,6 +61,9 @@ gst_qa_runner_class_init (GstQaRunnerClass * klass)
   gobject_class = G_OBJECT_CLASS (klass);
 
   gobject_class->dispose = gst_qa_runner_dispose;
+
+  /* init the report system (can be called multiple times) */
+  gst_qa_report_init ();
 }
 
 static void