Commit ec881c41a4bcb1512d2683032ecc7c4cb5bcbdc9

Con Kolivas 2013-08-25T14:59:35

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

diff --git a/util.c b/util.c
index ac59361..cf28a08 100644
--- a/util.c
+++ b/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)