35 lines
1.8 KiB
C
35 lines
1.8 KiB
C
/*
|
|
* Licensed under the GNU General Public License version 2 with exceptions. See
|
|
* LICENSE file in the project root for full license information
|
|
*/
|
|
|
|
#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);
|
|
|
|
#endif
|