Mercurial > flash_v2
changeset 1051:7d1bfa2391f9
* tests/clock.c (main): Avoid div-by-zero if mean==0.
* cdl/time.cdl: build all POSIX files all the time because they
are used internally by the standard ISO C functions even if not
exported.
[Bug 1000001]
| author | jlarmour |
|---|---|
| date | Fri, 13 Jun 2003 14:05:54 +0000 |
| parents | c07b9a1eed80 |
| children | ee5b3444e088 |
| files | packages/language/c/libc/time/current/ChangeLog packages/language/c/libc/time/current/cdl/time.cdl packages/language/c/libc/time/current/tests/clock.c |
| diffstat | 3 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/language/c/libc/time/current/ChangeLog +++ b/packages/language/c/libc/time/current/ChangeLog @@ -1,3 +1,12 @@ +2003-06-13 Jonathan Larmour <jifl@eCosCentric.com> + + * tests/clock.c (main): Avoid div-by-zero if mean==0. + + * cdl/time.cdl: build all POSIX files all the time because they + are used internally by the standard ISO C functions even if not + exported. + [Bug 1000001] + 2003-04-24 Robert Cragie <rcc@jennic.com> * include/time.inl:
--- a/packages/language/c/libc/time/current/cdl/time.cdl +++ b/packages/language/c/libc/time/current/cdl/time.cdl @@ -65,12 +65,20 @@ cdl_package CYGPKG_LIBC_TIME { requires CYGINT_ISO_DIV requires CYGINT_ISO_ABS + # Note: the POSIX files asctime_r,ctime_r,gmtime_r and + # localtime_r should be built all the time, not just in + # CYGFUN_LIBC_TIME_POSIX because the internal definitions + # are used by the ISO C functions regardless. Otherwise we + # get problems with certain inlining combinations. [Bug 1000001] + compile asctime.cxx clock.cxx \ ctime.cxx difftime.cxx \ gmtime.cxx localtime.cxx \ mktime.cxx settime.cxx \ strftime.cxx time.cxx \ - timeutil.cxx + timeutil.cxx asctime_r.cxx \ + ctime_r.cxx gmtime_r.cxx \ + localtime_r.cxx # ==================================================================== @@ -116,8 +124,7 @@ cdl_package CYGPKG_LIBC_TIME { display "POSIX time functions" default_value 1 requires CYGFUN_LIBC_STRING_BSD_FUNCS - compile asctime_r.cxx ctime_r.cxx gmtime_r.cxx \ - localtime_r.cxx strptime.cxx + compile strptime.cxx description " Enabling this option allows the use of the following functions defined in POSIX 1003.1:
--- a/packages/language/c/libc/time/current/tests/clock.c +++ b/packages/language/c/libc/time/current/tests/clock.c @@ -221,7 +221,8 @@ main(int argc, char *argv[]) for (i=SKIPPED_SAMPLES;i<SAMPLES;i++) { unsigned long err; - err = (100 * my_abs(ctrs[i]-mean)) / mean; + // use mean+1 as divisor to avoid div-by-zero + err = (100 * my_abs(ctrs[i]-mean)) / (mean+1); if (err > TOLERANCE) { diag_printf("mean=%d, ctrs[%d]=%d, err=%d\n", mean, i, ctrs[i], err);
