Mon May 15 14:26:00 2000 Joel Sherrill <joel@oarcorp.com>
* libc/sys/rtems/sys/time.h: Add macros for manipulating timeval structures.
This commit is contained in:
parent
4004738117
commit
75362a768b
@ -1,3 +1,8 @@
|
||||
Mon May 15 14:26:00 2000 Joel Sherrill <joel@oarcorp.com>
|
||||
|
||||
* libc/sys/rtems/sys/time.h: Add macros for manipulating timeval
|
||||
structures.
|
||||
|
||||
Wed May 10 19:24:53 2000 Jim Wilson <wilson@cygnus.com>
|
||||
|
||||
* libc/include/machine/ieeefp.h: Add ia64 support.
|
||||
|
@ -65,6 +65,33 @@ int gettimeofday(
|
||||
struct timezone *tzp
|
||||
);
|
||||
|
||||
/* Convenience macros for operations on timevals.
|
||||
NOTE: `timercmp' does not work for >= or <=. */
|
||||
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
|
||||
#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
|
||||
#define timercmp(a, b, CMP) \
|
||||
(((a)->tv_sec == (b)->tv_sec) ? \
|
||||
((a)->tv_usec CMP (b)->tv_usec) : \
|
||||
((a)->tv_sec CMP (b)->tv_sec))
|
||||
#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)
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user