X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstlink-usb.c;h=d945f66ecc391abf500160c9de78a507d57dcf7d;hb=691e9af28da2e1178353a5c016c478e508a04f19;hp=8f5c6c410c46420166f817bab8e781db8bc64d62;hpb=087a3596c3f22599867411fafb79fdfb3f48097c;p=fw%2Fstlink diff --git a/src/stlink-usb.c b/src/stlink-usb.c index 8f5c6c4..d945f66 100644 --- a/src/stlink-usb.c +++ b/src/stlink-usb.c @@ -16,6 +16,18 @@ #define WLOG(format, args...) ugly_log(UWARN, LOG_TAG, format, ## args) #define fatal(format, args...) ugly_log(UFATAL, LOG_TAG, format, ## args) +#ifndef timersub +/* This is a copy from GNU C Library (GNU LGPL 2.1), sys/time.h. */ +# define timersub(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ + if ((result)->tv_usec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_usec += 1000000; \ + } \ + } while (0) +#endif enum SCSI_Generic_Direction {SG_DXFER_TO_DEV=0, SG_DXFER_FROM_DEV=0x80};