cgtimer_sub is now the same since cgtimer_t should be the same on all platforms.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
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)