From b553c6d921e4cfc0e344eb9fbe169f94e37c6c99 Mon Sep 17 00:00:00 2001
From: Andoni Morales Alastruey <amorales@flumotion.com>
Date: Wed, 18 Aug 2010 16:56:03 +0200
Subject: [PATCH 2/4] [cpureport] make use of a monotic clock to measure 'actual-time'

---
 gst/debugutils/cpureport.c |   10 +++++-----
 gst/debugutils/cpureport.h |    4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gst/debugutils/cpureport.c b/gst/debugutils/cpureport.c
index 1f16e31..3643d7e 100644
--- a/gst/debugutils/cpureport.c
+++ b/gst/debugutils/cpureport.c
@@ -103,7 +103,7 @@ static GstFlowReturn
 gst_cpu_report_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
 {
   GstCpuReport *filter;
-  GTimeVal cur_time;
+  struct timespec cur_time;
   struct timespec cur_cpu_time;
   GstMessage *msg;
   GstStructure *s;
@@ -111,14 +111,14 @@ gst_cpu_report_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
   gint64 cpu_time;
 
 
-  g_get_current_time (&cur_time);
+  clock_gettime (CLOCK_MONOTONIC, &cur_time);
   clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &cur_cpu_time);
 
   filter = GST_CPU_REPORT (trans);
 
 
-  time_taken = GST_TIMEVAL_TO_TIME (cur_time) -
-      GST_TIMEVAL_TO_TIME (filter->last_time);
+  time_taken = GST_TIMESPEC_TO_TIME (cur_time) -
+      GST_TIMESPEC_TO_TIME (filter->last_time);
 
   cpu_time = GST_TIMESPEC_TO_TIME (cur_cpu_time) -
       GST_TIMESPEC_TO_TIME (filter->last_cpu_time);
@@ -142,7 +142,7 @@ gst_cpu_report_start (GstBaseTransform * trans)
 
   filter = GST_CPU_REPORT (trans);
 
-  g_get_current_time (&filter->last_time);
+  clock_gettime (CLOCK_MONOTONIC, &filter->last_time);
   filter->start_time = filter->last_time;
   clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &filter->last_cpu_time);
   return TRUE;
diff --git a/gst/debugutils/cpureport.h b/gst/debugutils/cpureport.h
index 8fa5aa2..59de0a9 100644
--- a/gst/debugutils/cpureport.h
+++ b/gst/debugutils/cpureport.h
@@ -42,8 +42,8 @@ struct _GstCpuReport
 {
   GstBaseTransform basetransform;
 
-  GTimeVal start_time;
-  GTimeVal last_time;
+  struct timespec start_time;
+  struct timespec last_time;
   struct timespec last_cpu_time;
 };
 
-- 
1.7.0.4

