diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2000-12-04 18:40:53 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2000-12-04 18:40:53 +0000 |
commit | 8677b81966edaa9316e021cbfde950af95701f9c (patch) | |
tree | 5e4ca527722a12107b430c0cd23db0a99febdc67 /newlib | |
parent | 1b61a7060f7d51c9c8db162200d6b94b3404c904 (diff) | |
download | newlib-8677b81966edaa9316e021cbfde950af95701f9c.zip newlib-8677b81966edaa9316e021cbfde950af95701f9c.tar.gz newlib-8677b81966edaa9316e021cbfde950af95701f9c.tar.bz2 |
2000-12-04 Joel Sherrill <joel@OARcorp.com>
* libc/include/sys/time.h: Added BSD timer manipulation macros
used by RTEMS code.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/include/sys/time.h | 32 |
2 files changed, 37 insertions, 0 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 2a40572..f5ffe44 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,5 +1,10 @@ 2000-12-04 Joel Sherrill <joel@OARcorp.com> + * libc/include/sys/time.h: Added BSD timer manipulation macros + used by RTEMS code. + +2000-12-04 Joel Sherrill <joel@OARcorp.com> + * libc/sys/rtems/crt0.c: Add stubs for functions implicitly referenced by code generated by gcc 2.8.1. (a29k): Add stubs for V_SPILL, V_FILL, V_BSD_OS, V_EPI_OS to diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h index ff09636..8819983 100644 --- a/newlib/libc/include/sys/time.h +++ b/newlib/libc/include/sys/time.h @@ -38,6 +38,38 @@ struct itimerval { struct timeval it_value; }; +/* BSD time macros used by RTEMS code */ +#if defined(__rtems__) + +/* 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) +#endif + int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z)); int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *)); int _EXFUN(utimes, (const char *__path, struct timeval *__tvp)); |