1 /* time.h -- An implementation of the standard Unix <sys/time.h> file.
2 Written by Geoffrey Noer <noer@cygnus.com>
3 Public domain; no rights reserved. */
26 #if defined(__CYGWIN__) || defined(__MSYS__)
27 #include <sys/select.h>
28 #endif /* __CYGWIN__ or __MSYS__ */
30 #endif /* _WINSOCK_H */
33 #define ITIMER_VIRTUAL 1
37 struct timeval it_interval
;
38 struct timeval it_value
;
41 /* BSD time macros used by RTEMS code */
42 #if defined (__rtems__) || defined (__CYGWIN__) || defined (__MSYS__)
44 /* Convenience macros for operations on timevals.
45 NOTE: `timercmp' does not work for >= or <=. */
46 #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
47 #define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
48 #define timercmp(a, b, CMP) \
49 (((a)->tv_sec == (b)->tv_sec) ? \
50 ((a)->tv_usec CMP (b)->tv_usec) : \
51 ((a)->tv_sec CMP (b)->tv_sec))
52 #define timeradd(a, b, result) \
54 (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
55 (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
56 if ((result)->tv_usec >= 1000000) \
59 (result)->tv_usec -= 1000000; \
62 #define timersub(a, b, result) \
64 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
65 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
66 if ((result)->tv_usec < 0) { \
68 (result)->tv_usec += 1000000; \
71 #endif /* defined (__rtems__) || defined (__CYGWIN__) || defined (__MSYS__) */
73 int _EXFUN(gettimeofday
, (struct timeval
*__p
, struct timezone
*__z
));
74 int _EXFUN(settimeofday
, (const struct timeval
*, const struct timezone
*));
75 int _EXFUN(utimes
, (const char *__path
, struct timeval
*__tvp
));
76 int _EXFUN(getitimer
, (int __which
, struct itimerval
*__value
));
77 int _EXFUN(setitimer
, (int __which
, const struct itimerval
*__value
,
78 struct itimerval
*__ovalue
));
83 #endif /* _SYS_TIME_H_ */