Browse Source

cgtimer_sub is now the same since cgtimer_t should be the same on all platforms.

Con Kolivas 12 years ago
parent
commit
ec881c41a4
1 changed files with 11 additions and 21 deletions
  1. 11 21
      util.c

+ 11 - 21
util.c

@@ -880,6 +880,17 @@ static int timespec_to_ms(struct timespec *ts)
 	return ts->tv_sec * 1000 + ts->tv_nsec / 1000000;
 }
 
+/* Subtracts b from a and stores it in res. */
+void cgtimer_sub(cgtimer_t *a, cgtimer_t *b, cgtimer_t *res)
+{
+	res->tv_sec = a->tv_sec - b->tv_sec;
+	res->tv_nsec = a->tv_nsec - b->tv_nsec;
+	if (res->tv_nsec < 0) {
+		res->tv_nsec += 1000000000;
+		res->tv_sec--;
+	}
+}
+
 /* These are cgminer specific sleep functions that use an absolute nanosecond
  * resolution timer to avoid poor usleep accuracy and overruns. */
 #ifndef WIN32
@@ -923,17 +934,6 @@ int cgtimer_to_ms(cgtimer_t *cgt)
 	return timespec_to_ms(cgt);
 }
 
-/* Subtracts b from a and stores it in res. */
-void cgtimer_sub(cgtimer_t *a, cgtimer_t *b, cgtimer_t *res)
-{
-	res->tv_sec = a->tv_sec - b->tv_sec;
-	res->tv_nsec = a->tv_nsec - b->tv_nsec;
-	if (res->tv_nsec < 0) {
-		res->tv_nsec += 1000000000;
-		res->tv_sec--;
-	}
-}
-
 /* This is a cgminer gettimeofday wrapper. Since we always call gettimeofday
  * with tz set to NULL, and windows' default resolution is only 15ms, this
  * gives us higher resolution times on windows. */
@@ -1021,16 +1021,6 @@ int cgtimer_to_ms(cgtimer_t *cgt)
 {
 	return timespec_to_ms(cgt);
 }
-
-void cgtimer_sub(cgtimer_t *a, cgtimer_t *b, cgtimer_t *res)
-{
-	res->tv_sec = a->tv_sec - b->tv_sec;
-	res->tv_nsec = a->tv_nsec - b->tv_nsec;
-	if (res->tv_nsec < 0) {
-		res->tv_nsec += 1000000000;;
-		res->tv_sec--;
-	}
-}
 #endif
 
 void cgsleep_ms(int ms)