use BSD timersub

pull/79/head
Dave Murphy 2012-05-16 23:41:42 +01:00
rodzic 4080a3ecbb
commit 299c5d272f
1 zmienionych plików z 12 dodań i 11 usunięć

Wyświetl plik

@ -16,17 +16,18 @@
#define WLOG(format, args...) ugly_log(UWARN, LOG_TAG, format, ## args) #define WLOG(format, args...) ugly_log(UWARN, LOG_TAG, format, ## args)
#define fatal(format, args...) ugly_log(UFATAL, LOG_TAG, format, ## args) #define fatal(format, args...) ugly_log(UFATAL, LOG_TAG, format, ## args)
#ifndef timersub /* code from bsd timersub.h
/* This is a copy from GNU C Library (GNU LGPL 2.1), sys/time.h. */ http://www.gnu-darwin.org/www001/src/ports/net/libevnet/work/libevnet-0.3.8/libnostd/bsd/sys/time/timersub.h.html
# define timersub(a, b, result) \ */
do { \ #if !defined timersub
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ #define timersub(a, b, r) do { \
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ (r)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
if ((result)->tv_usec < 0) { \ (r)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
--(result)->tv_sec; \ if ((r)->tv_usec < 0) { \
(result)->tv_usec += 1000000; \ --(r)->tv_sec; \
} \ (r)->tv_usec += 1000000; \
} while (0) } \
} while (0)
#endif #endif
enum SCSI_Generic_Direction {SG_DXFER_TO_DEV=0, SG_DXFER_FROM_DEV=0x80}; enum SCSI_Generic_Direction {SG_DXFER_TO_DEV=0, SG_DXFER_FROM_DEV=0x80};