2015-03-12 04:45:16 +08:00
|
|
|
/*
|
2017-03-29 13:16:44 +08:00
|
|
|
* Licensed under the GNU General Public License version 2 with exceptions. See
|
|
|
|
* LICENSE file in the project root for full license information
|
2014-11-25 23:10:29 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _osal_win32_
|
|
|
|
#define _osal_win32_
|
|
|
|
|
|
|
|
/* Convenience macros for operations on timevals.
|
|
|
|
NOTE: `timercmp' does not work for >= or <=. */
|
|
|
|
# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
|
|
|
|
# define timeradd(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 >= 1000000) \
|
|
|
|
{ \
|
|
|
|
++(result)->tv_sec; \
|
|
|
|
(result)->tv_usec -= 1000000; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
# 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)
|
|
|
|
|
|
|
|
int osal_gettimeofday (struct timeval *tv, struct timezone *tz);
|
2015-11-04 20:02:33 +08:00
|
|
|
|
2014-11-25 23:10:29 +08:00
|
|
|
#endif
|