diff --git a/src/time/ctime.cpp b/src/time/ctime.cpp
index 29efe06295b857aa1a93a0c726342a1f24bc22a1..6923fa04241dd3afba1cfe7f05d85fac80da6967 100644
--- a/src/time/ctime.cpp
+++ b/src/time/ctime.cpp
@@ -128,8 +128,12 @@ void CTime::set(double milliseconds)
   this->nsec = time_temp.tv_nsec;
   if(this->use_zero && milliseconds<0.0)
   {
-    this->sec  -= this->zero.seconds();
-    this->nsec -= this->zero.nanoseconds();
+    CTime tmp;
+    tmp.sec    = this->sec;
+    tmp.nsec   = this->nsec;
+    tmp        = diff(tmp,this->zero);
+    this->sec  = tmp.sec;
+    this->nsec = tmp.nsec;
   }
 }
 
@@ -153,6 +157,21 @@ void CTime::resetRef()
 void CTime::useRef(bool use)
 {
   this->use_zero = use;
+  CTime tmp;
+  tmp.sec    = this->sec;
+  tmp.nsec   = this->nsec;
+  tmp        = diff(tmp,this->zero);
+  this->sec  = tmp.sec;
+  this->nsec = tmp.nsec;
+  /*
+  if ( (long)this->nsec - (long)this->zero.seconds() < 0 )
+  {
+    this->sec  -= this->zero.seconds() - 1;
+    this->nsec += 1000000000 - this->zero.nanoseconds();
+  } else {
+    this->sec  -= this->zero.seconds();
+    this->nsec -= this->zero.nanoseconds();
+  }*/
 }
 
 bool CTime::isRefUsed()
@@ -160,23 +179,40 @@ bool CTime::isRefUsed()
   return this->use_zero;
 }
 
-// OPERATIONS
-CTime CTime::operator - (CTime &t)
+CTime CTime::diff(CTime &t0, CTime &t1)
 {
   CTime tmp;
-
-  if ( (long)this->nsec - (long)t.nsec < 0 )
+  tmp = t0;
+  if ( (long)t0.nsec - (long)t1.sec < 0 )
   {
-    tmp.sec  = this->sec - t.sec - 1;
-    tmp.nsec = 1000000000 + this->nsec - t.nsec;
+    tmp.sec  -= t1.sec - 1;
+    tmp.nsec += 1000000000 - t1.nsec;
   } else {
-    tmp.sec  = this->sec  - t.sec;
-    tmp.nsec = this->nsec - t.nsec;
+    tmp.sec  -= t1.sec;
+    tmp.nsec -= t1.nsec;
   }
-
   return tmp;
 }
 
+// OPERATIONS
+CTime CTime::operator - (CTime &t)
+{
+  CTime tmp;
+  tmp.sec=this->sec;
+  tmp.nsec=this->nsec;
+
+//   if ( (long)this->nsec - (long)t.nsec < 0 )
+//   {
+//     tmp.sec  = this->sec - t.sec - 1;
+//     tmp.nsec = 1000000000 + this->nsec - t.nsec;
+//   } else {
+//     tmp.sec  = this->sec  - t.sec;
+//     tmp.nsec = this->nsec - t.nsec;
+//   }
+
+  return diff(tmp,t);
+}
+
 CTime CTime::operator + (CTime &t)
 {
   CTime tmp;
diff --git a/src/time/ctime.h b/src/time/ctime.h
index d2d13a25116f719bc363e82561e73c93a21ab106..0d90882ab461f4ed7a34f368dd9cb9445c8409eb 100644
--- a/src/time/ctime.h
+++ b/src/time/ctime.h
@@ -310,6 +310,8 @@ class CTime
     */
     void resetRef();
 
+    CTime diff(CTime &t0, CTime &t1);
+
   ///@}
 
   /// @name Operators