usbutils cps correct time measurement
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
diff --git a/usbutils.c b/usbutils.c
index 6e32a96..30b64e6 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2320,7 +2320,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
cgtime(&now);
need = (double)(usbdev->last_write_siz) /
(double)(usbdev->cps) -
- tdiff(&(usbdev->last_write_tv), &now);
+ tdiff(&now, &(usbdev->last_write_tv));
// Simple error condition check/avoidance '< 1.0'
if (need > 0.0 && need < 1.0) {
@@ -2429,7 +2429,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
cgtime(&now);
need = (double)(usbdev->last_write_siz) /
(double)(usbdev->cps) -
- tdiff(&(usbdev->last_write_tv), &now);
+ tdiff(&now, &(usbdev->last_write_tv));
// Simple error condition check/avoidance '< 1.0'
if (need > 0.0 && need < 1.0) {
@@ -2575,7 +2575,7 @@ int _usb_write(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pr
cgtime(&now);
need = (double)(usbdev->last_write_siz) /
(double)(usbdev->cps) -
- tdiff(&(usbdev->last_write_tv), &now);
+ tdiff(&now, &(usbdev->last_write_tv));
// Simple error condition check/avoidance '< 1.0'
if (need > 0.0 && need < 1.0) {
@@ -2672,7 +2672,7 @@ int __usb_transfer(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bReques
cgtime(&now);
need = (double)(usbdev->last_write_siz) /
(double)(usbdev->cps) -
- tdiff(&(usbdev->last_write_tv), &now);
+ tdiff(&now, &(usbdev->last_write_tv));
// Simple error condition check/avoidance '< 1.0'
if (need > 0.0 && need < 1.0) {
@@ -2749,7 +2749,7 @@ int _usb_transfer_read(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bRe
cgtime(&now);
need = (double)(usbdev->last_write_siz) /
(double)(usbdev->cps) -
- tdiff(&(usbdev->last_write_tv), &now);
+ tdiff(&now, &(usbdev->last_write_tv));
// Simple error condition check/avoidance '< 1.0'
if (need > 0.0 && need < 1.0) {